-
Notifications
You must be signed in to change notification settings - Fork 0
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
Card component #571
Conversation
…to the Card component
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.
|
||
const store = configureStore(); | ||
|
||
// TODO: There is a problem when loading this stories twice |
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.
Can you describe the problem?
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.
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.
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.
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.
<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> |
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.
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.
Solving it by the power of :has()
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.
<Tooltip | ||
title={`${data.metadata.source_organism.fullName} (Tax ID: ${data.metadata.source_organism.taxId})`} | ||
> | ||
{data.metadata.source_organism.fullName} |
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.
Could be a link to the organism.
Co-authored-by: Matthias Blum <[email protected]>
Co-authored-by: Matthias Blum <[email protected]>
3 Co-authored-by: Matthias Blum <[email protected]>
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