Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mai/Fix-413-added in Link to logo #446

Merged
merged 9 commits into from
Jul 31, 2024

Conversation

vmaineng
Copy link
Contributor

fixes #413

  1. added Link to LogoNav
  2. created a unit test to ensure link existed.
Screen.Recording.2024-07-20.at.12.39.47.PM.mov
Screenshot 2024-07-20 at 12 38 38 PM

@vmaineng vmaineng requested review from shashilo and mhchen as code owners July 20, 2024 19:41
Copy link

appwrite bot commented Jul 20, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function deployment has failed. Please check the logs for more details and retry.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b failed Failed View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
Appwrite has a Discord community with over 16 000 members. Come join us!

Copy link

vercel bot commented Jul 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2024 11:24am
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2024 11:24am

@vmaineng vmaineng changed the title added in Link to logo Mai/Fix-413-added in Link to logo Jul 20, 2024
alexappleget
alexappleget previously approved these changes Jul 20, 2024
it('renders the logo and links to the /league/all page', () => {
render(<LogoNav />);

const logoImage = screen.getByAltText('Gridiron Survivor logo');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never grab a component by the alt text. This could change any time, thus failing your test very easily. Add a data-testid, then find the component by this attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to grab by getByTestId instead.

className="w-20"
data-testid="logo-nav"
/>
<Link href="/league/all" passHref>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does passHref do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per this Stackoverflow blog I was reading, it stated passHref is needed for a functional component per the nextjs documentation, but as I'm reading this again, it stated to 'pass it whenever you use a react component as a child' and for this logo instance, there are no children now that I think about it and will be removing the passHref.

https://stackoverflow.com/questions/68983089/is-it-necessary-to-pass-passhref-to-nextjs-link-having-a-semantic-ui-react-a

<Image
src={logo}
alt="Gridiron Survivor logo"
width={1}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

width and height of 1px?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. It seemed the changes were made prior to my change but let me check with the Figma design.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed width, height, className, and priority and verified design specs adhere to Figma's design.

image

components/LogoNav/LogoNav.tsx Outdated Show resolved Hide resolved
Copy link
Member

@ryandotfurrer ryandotfurrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ryandotfurrer
ryandotfurrer previously approved these changes Jul 23, 2024
Copy link
Member

@ryandotfurrer ryandotfurrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

<Link href="/league/all">
<Image
src={logo}
width={80}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this scale for the mobile view?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scale view perspective shows height={36} and width={80}.

image

/>
<Link href="/league/all">
<Image
src={logo}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetize your attribute names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-alphabetize.

ryandotfurrer
ryandotfurrer previously approved these changes Jul 27, 2024
expect(logoImage).toBeInTheDocument();

const linkElement = screen.getByRole('link', {
name: /Gridiron Survivor logo/i,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question, what's the forward-slashes and "i" do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryandotfurrer it's regex to look for the specific word of 'Gridiron Survivor Logo'. Here's a great blog about the i in Regex: https://www.w3schools.com/jsref/jsref_regexp_i.asp. Please let me know if this makes sense :)

const logoImage = screen.getByTestId('logo-nav');
expect(logoImage).toBeInTheDocument();

const linkElement = screen.getByRole('link', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to use the datatest-id of logo-nav here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data-testid="logo-nav" is currently used for the Image tag. I like the idea of adding a data-testID to test the Link tag and will implement one shortly.

@vmaineng vmaineng merged commit 952563d into develop Jul 31, 2024
5 checks passed
@vmaineng vmaineng deleted the 413-bug-bash-add-link-to-home-from-nav-l branch July 31, 2024 14:15
@vmaineng vmaineng restored the 413-bug-bash-add-link-to-home-from-nav-l branch July 31, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Bash: Add link to home from nav logo
4 participants