-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: Implement DS styles and unify modals #11212
Conversation
Added the styles to the theme file aligned with the DS styles & replaced the QuizzesModal with the current customized modal component.
✅ ethereum-org-website-dev deploy preview ready
|
Taking a quick moment to mention that |
Thanks @TylerAPfledderer |
@ashiskumar-1999 hmmm, I believe there are two things that should be done first before this can get a proper review:
Since the This would mean
For further guidance on creating this stories file and using it for visual testing, there is a doc in the project repo to view. However, I just recognized that it is a bit out-of-date. Therefore, I would view the file via a PR I just opened. Though subject to change, this would be more accurate documentation. See this commit of the file from that PR and we'll go from there. |
Hi @TylerAPfledderer, |
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 have provided suggestions to the most recent changes.
With the Storybook file, we want to favor Single-story hoisting, since there only one story expected to be used for the modal at this time. This means updating namings to import alias of the component, the story title and the single story itself.
@@ -0,0 +1,20 @@ | |||
import { Meta, StoryObj } from "@storybook/react" | |||
import Modal from "." |
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.
import Modal from "." | |
import ModalComponent from "." |
const meta = { | ||
title: "Molecules/Overlay Content/Modal/BaseModal", | ||
component: Modal, | ||
} satisfies Meta<typeof Modal> |
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.
In addition to import alias name change.
The title should only account for the name of the component, whether or not there is just one story.
const meta = { | |
title: "Molecules/Overlay Content/Modal/BaseModal", | |
component: Modal, | |
} satisfies Meta<typeof Modal> | |
const meta = { | |
title: "Molecules/Overlay Content/Modal", | |
component: ModalComponent, | |
} satisfies Meta<typeof ModalComponent> |
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
export const BaseModal: Story = { |
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.
Because the alias import of the component is renamed to ModalComponent
and the directory path of this story file (The title
in the meta object) ends with Modal
, then we can give this story the same name, and Storybook will just generate the story and not a folder for it to be housed in. This tidies up the directory structure with only one story being rendered for the component.
export const BaseModal: Story = { | |
export const Modal: Story = { |
You can read more here about Single-Story Hoisting
export const BaseModal: Story = { | |
export const Modal: Story = { |
src/pages/quizzes.tsx
Outdated
@@ -95,14 +96,14 @@ const QuizzesHubPage = ({ data }: PageProps<Queries.QuizzesHubPageQuery>) => { | |||
</Box> | |||
|
|||
<QuizzesHubContext.Provider value={contextState}> | |||
<QuizzesModal isOpen={isOpen} onClose={onClose}> | |||
<Modal isOpen={isOpen} setIsOpen={onClose}> |
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 not replace QuizzesModal
here. Rather, update that component instead to use the custom Modal
over the one imported directly from Chakra.
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 use directly the Modal component instead of updating the QuizzesModal. Because we have set another prop for the isOpen & setIsOpen prop of the custom Modal & we can add the value where the QuizzesModal component is being rendered. 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.
@ashiskumar-1999 it's more about the custom styling that is added to this instance of the modal and keeping that styling in isolation. In particular, there is conditional rendering of the background color and the use of the size prop based on screen size.
Also it would be easier to continue handling the background style in QuizzesModal
than trying to do the logic in a variant for something primitive. That's not how a theme variant should be applied.
/* borderTop: "1px solid", | ||
borderBottom: "1px solid", */ | ||
padding: 0, | ||
textTransform: "uppercase", |
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 a part of the DS
textTransform: "uppercase", |
fontSize: "md", | ||
fontFamily: "Inter", | ||
}, | ||
footer: { |
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.
The footer part needs it's padding updated. Currently, the ModalFooter
component renders it's own padding.
Add:
px: 0,
pt: "8",
pb: 0,
This will create the necessary overrides here and match the DS is the extended spacing above the buttons.
@nloureiro PR ready for review (once the build finishes). As discussed, we have:
The affected modals and pages where you can see them are:
|
@pettinarip looks great! great work I found one tiny, tiny detail that it's not a blocker. I will create an issue later on. |
@pettinarip This look ready from your perspective? I'm noticing the content of the Quiz modal |
From my side, it's better centered. |
Congrats, your important contribution to this open-source project has earned you a GitPOAP! Be sure to join the Ethereum.org discord if you are interested in contributing further to the project or have any questions for the team. GitPOAP: 2024 Ethereum.org Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Description
Implemented the styles from the DS to the Modal theme file & component. Replaced the existing modal implementation with the current Modal.
index.tsx
file instead of CodeModal component.Preview link
Related Issue