-
Notifications
You must be signed in to change notification settings - Fork 15
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
Catalog from wanda #960
Catalog from wanda #960
Conversation
eff714e
to
0d2e52f
Compare
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.
Nice! Some tweaks and I think we can merge this 👍
<div | ||
key={idx} | ||
className="check-group bg-white shadow overflow-hidden sm:rounded-md mb-8" | ||
> | ||
<div className="bg-white px-4 py-5 border-b border-gray-200 sm:px-6"> | ||
<h3 className="text-lg leading-6 font-medium text-gray-900"> | ||
{group} | ||
</h3> | ||
</div> | ||
<ul role="list" className="divide-y divide-gray-200"> | ||
{checks.map((check) => ( | ||
<li key={check.id}> | ||
<Disclosure> | ||
<Disclosure.Button | ||
as="div" | ||
className="flex justify-between w-full cursor-pointer hover:bg-gray-100" | ||
> | ||
<div className="check-row px-4 py-4 sm:px-6"> | ||
<div className="flex items-center"> | ||
<p className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"> | ||
{check.id} | ||
</p> | ||
{check.premium > 0 && ( | ||
<p className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"> | ||
Premium | ||
</p> | ||
)} | ||
</div> | ||
<div className="mt-2 sm:flex sm:justify-between"> | ||
<div className="sm:flex"> | ||
<ReactMarkdown | ||
className="markdown text-sm" | ||
remarkPlugins={[remarkGfm]} | ||
> | ||
{check.description} | ||
</ReactMarkdown> |
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.
Do we wanna extract all this markup in some more granular components?
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.
Do you mean to create our own markdown component with those defaults?
In this case text-sm
would be an additional style.
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 we do the next? Let me merge this as it is about this topic, and I will create other PR with a new markdown component and use it all around the code. What do you think?
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.
Not the markdown, I mean the whole HTML body of this component 😅
In a similar way to https://github.com/trento-project/web/blob/main/assets/js/components/ChecksResults/ChecksResults.jsx, we can make this code more readable just having a wrapper component for the div
s and the ul
and another component for the li
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.
Anyway if you wanna do that in a subsequent PR, feel free.
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.
@dottorblaster CheckItem extracted to an individual component. Going further looks like an overkill to me
85aab9e
to
f3271e2
Compare
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.
Sorry, really. Last thing then we can merge 👍
assets/js/trento.jsx
Outdated
import ChecksCatalog from '@components/ChecksCatalog'; | ||
import { ChecksCatalogNew } from '@components/ChecksCatalog'; |
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.
Sorry ❤️ last thing 😄 could you group these imports? You can do that just by doing import ChecksCatalog, { ChecksCatalogNew } from...
Looks good to me, I'm with @dottorblaster on all the other comments, I think that we could add some data-testid attributes/props on component to better test them even in the future, like we already done other jest tests. For reference: https://testing-library.com/docs/queries/bytestid/ It's a nice to have btw, @arbulu89 good job! |
f3271e2
to
470b64c
Compare
Hey @CDimonaco , |
Perfect! LGTM |
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
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.
export const catalogCheckFactory = Factory.define(() => ({ | ||
id: faker.datatype.uuid(), | ||
name: faker.animal.cat(), | ||
group: faker.animal.cat(), |
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.
meow
FYI |
Description
Load catalog data from wanda. The same functionality as before, except there is no provider selection. The new view is available through
http://localhost:4000/catalog_new
PD: I have included a pair of dummy checks to show the groups in the result
How was this tested?
Tests on jest added