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

Card component #571

Merged
merged 51 commits into from
Feb 5, 2024
Merged

Card component #571

merged 51 commits into from
Feb 5, 2024

Conversation

gustavo-salazar
Copy link
Member

In this PR there is a new simple component: <Card>

This replaces all uses of direct html+css to create cards, by using the new component, to standardize and centralize all multiple CSS definitions of cards in a single component.

It also includes storybook stories to exemplify the different usages of Cards: from the raw usage of the component to the ones specific to endpoints in the table view.

Also, remove files in the About and Help section that were not in use.

Plus TS migrations wherever possible. e.g. Info Banner, BlogEntries, About/InterProScan

@coveralls
Copy link

coveralls commented Jan 29, 2024

Coverage Status

coverage: 23.833% (+0.2%) from 23.678%
when pulling e1beaa2 on card-component
into 1c3f77e on dev.

@gustavo-salazar gustavo-salazar marked this pull request as ready for review January 29, 2024 16:40
Copy link
Contributor

@matthiasblum matthiasblum left a comment

Choose a reason for hiding this comment

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

LGTM.

Minor suggestions, but nothing preventing merging.


It was a big PR. Clicking the image has never been so tempting.

LKTTAzGboJGzC


const store = configureStore();

// TODO: There is a problem when loading this stories twice
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you describe the problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

storybook breaks in the browser. And the console shows an error stack trace that starts with:

Uncaught TypeError: Converting circular structure to JSON

Something in the Protein Viewer is mutating the original data, probably the way we use d3. This is not an issue in the website because data always gets calculated from the API payload, so basically starts with new data every time it gets into a protein viewer. But in the story, it reuses the same variable, so the mutations persist.

Or at least that's my suspicion, I'm thinking we can use the same way we import the data for skylign, and that might solve the storybook issue. A better, but more time-consuming fix will be checking the components themselves to make their methods unmutable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mhh, writing it in the old storybook format did the trick. I'm guessing that way it doesn't try to reuse the same variables.

Comment on lines +55 to +74
<div
className={css(
'card-tag',
`tag-${category === 'focus' ? 'focus' : 'blog'}`,
)}
>
<Tooltip
title={`View all ${
category === 'focus' ? 'Protein focus' : 'Blog articles'
}`}
>
<Link
href={`${BLOG_ROOT}/categories/${category}/`}
target="_blank"
className={css('white-link')}
>
{category === 'focus' ? 'Protein focus' : 'Blog'}
</Link>
</Tooltip>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly overlaps with the card's title, e.g.

image

Copy link
Member Author

@gustavo-salazar gustavo-salazar Feb 5, 2024

Choose a reason for hiding this comment

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

Solving it by the power of :has()

Copy link
Contributor

Choose a reason for hiding this comment

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

Label overflows out of container if no background image is used, e.g.

image

<Tooltip
title={`${data.metadata.source_organism.fullName} (Tax ID: ${data.metadata.source_organism.taxId})`}
>
{data.metadata.source_organism.fullName}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be a link to the organism.

Base automatically changed from storybook-again to dev February 5, 2024 09:42
@gustavo-salazar gustavo-salazar merged commit ea0ae85 into dev Feb 5, 2024
3 checks passed
@gustavo-salazar gustavo-salazar deleted the card-component branch February 5, 2024 15:35
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.

3 participants