-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Add hover states to bookmarks #987
Conversation
This pull request has been linked to Shortcut Story #1568: Add hover states to bookmarks. |
<svg | ||
width="20" | ||
height="20" | ||
viewBox="0 0 20 20" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM11 15H9V9H11V15ZM11 7H9V5H11V7Z" | ||
fill="currentColor" | ||
/> | ||
</svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this inline because we can change the fill
value to currentColor
and then control the color with CSS, as opposed to having to add a second icon for dark theme.
the info icon is not currently available to keyboard users |
…ssf-portal-client into sc-1568/bookmark-hover-info
@@ -63,8 +63,8 @@ const Error: NextPageWithLayout<Props> = ({ statusCode }: Props) => { | |||
) | |||
} | |||
|
|||
Error.getInitialProps = ({ res, err }: NextPageContext) => { | |||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is slick, it's not very intuitive. I rearranged it to be a little easier on the eyes.
{visibleBookmarks.map((bookmark: MongoBookmark, index) => { | ||
const foundBookmark = findBookmark(bookmark) | ||
return bookmark.cmsId && foundBookmark ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to add this check for an undefined bookmark here so that we could maintain the new and improved type-safe RemovableBookmark
component. So now if there is some misalignment between cmsId
and id
it will just display as a CustomBookmark
|
||
/* MongoBookmark refers to an existing bookmark as it is stored in MongoDB. This includes | ||
both user-created bookmarks and bookmarks that the user has added from the CMS. */ | ||
export type MongoBookmark = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we had briefly talked in eng sync about naming for this, MongoBookmark vs UserBookmark vs < something else >. @gidjin did you have a preference or strong opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is for UserBookmark
but I'm okay if it stays this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it as MongoBookmark
because, since we have bookmarks coming from two different places, it makes it more clear when working with a bookmark where it's coming from. Happy to change it if the need arises, but thought I'd clarify my intentions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with that reasoning. Thanks for noting it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Works as expected. A question around naming but it isn't a blocker for me.
One question for potential follow-up story: Should the hover/tooltip also show on Sites & Apps in the collection view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great on the myspace page! I don't see it on the sites&applications page though, can we put them there too?
Edit: Oh Abigail beat me to it!
url: bookmark.url, | ||
label: bookmark.label, | ||
collectionId, | ||
cmsId: bookmark.id, | ||
...bookmark, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
/* MongoBookmark refers to an existing bookmark as it is stored in MongoDB. This includes | ||
both user-created bookmarks and bookmarks that the user has added from the CMS. */ | ||
export type MongoBookmark = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is for UserBookmark
but I'm okay if it stays this way.
expect(screen.getByText('3 collections selected')).toBeInTheDocument() | ||
expect( | ||
screen.getByText('(0 of 25 possible remaining)') | ||
).toBeInTheDocument() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Did you intend to remove all the checks around the max # of collections or was that inadvertent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add this back, I'm going to do that today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked and this is covered just differently than before. I added a couple checks but I understand the test better now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking request for changes since I want to add the tests I flagged back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reviewed with bookmark hover updates working on sites & apps - LGTM!
SC-1568
Proposed changes
/sites-and-applications
page (forgot to do this in refactor: Refactor MySpace component #978)Still to do:
Fix testsReviewer notes
Run the app and
/sites-and-applications
and verify that everything there works as expected (since I removed thegetMySpace
query)Please give the e2e test a look as well: https://github.com/USSF-ORBIT/ussf-portal/pull/262
Setup
yarn services:up && yarn dev
in CMSyarn dev
in portalCode review steps
As the original developer, I have
As code reviewer(s), I have
As a designer reviewer, I have
As a test user, I have
Screenshots