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

[ShadCN] Migrate Quiz Components to ShadCN/Tailwind #13876

Merged
merged 38 commits into from
Oct 31, 2024

Conversation

TylerAPfledderer
Copy link
Contributor

@TylerAPfledderer TylerAPfledderer commented Sep 16, 2024

Description

Migrates the QuizWidget and related components to Tailwind.

This does not touch the logic for the custom radio components (useRadio and useRadioGroup from Chakra). Due to the size in scope of this PR, the logic and structure update should be handled in a follow-up PR.

Does not have an updated Modal component for QuizModal.

Takes an approach using data-* attributes in quizRadioGroup to handle style changes from boolean checks (i.e. change background color is answer is displayed and/or is correct). Some of this approach might be temporary upon removal of the above mentioned radio hooks.

Related Issue

Copy link

netlify bot commented Sep 16, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 84464b2
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/67235a68c0a078000865c6e6
😎 Deploy Preview https://deploy-preview-13876--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 48 (🔴 down 7 from production)
Accessibility: 92 (no change from production)
Best Practices: 89 (🔴 down 9 from production)
SEO: 99 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@TylerAPfledderer TylerAPfledderer changed the title refactor(QuizWidget/ButtonGroup): migrate component to Tailwind [ShadCN] Migrate QuizWidget to ShadCN/Tailwind Sep 16, 2024
@TylerAPfledderer TylerAPfledderer changed the title [ShadCN] Migrate QuizWidget to ShadCN/Tailwind [ShadCN] Migrate Quiz Components to ShadCN/Tailwind Sep 25, 2024
@pettinarip
Copy link
Member

Hey @TylerAPfledderer wanted to double check if this PR is still in draft mode or is ready for a review.

@TylerAPfledderer
Copy link
Contributor Author

Hey @TylerAPfledderer wanted to double check if this PR is still in draft mode or is ready for a review.

@pettinarip still working on it. 😁

id={radioInputProps.value}
data-testid="quiz-question-answer"
data-group
data-answer-visible={isAnswerVisible || undefined}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative approach instead of rendering data-* attributes for dynamic styling would be dynamically assigned CSS vars at a parent level to be called when hover or data-checked


const Stack = forwardRef<FlexElement, StackProps>(
({ className, separator, children, ...props }, ref) => {
const cloneChildren = useMemo(() => {
Copy link
Contributor Author

@TylerAPfledderer TylerAPfledderer Oct 3, 2024

Choose a reason for hiding this comment

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

Applied approach similar to the stack component from Chakra to still allow for some separator component to be passed in and rendered internally for repetition. This is needed for the Quiz Summary stats. This should not be a breaking change for other renders.

if (quizStatus === "neutral") {
return "background.base"
return "!bg-background"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forcing the styling because these utilities currently compete with Chakra style props from Modal

render: (args) => <QuizzesListComponent {...args} />,
}

export const OneCompletedQuiz: StoryObj<typeof meta> = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Provide UI confirmation that the checkmark will render on a completed quiz set.

@pettinarip pettinarip mentioned this pull request Oct 3, 2024
39 tasks
@pettinarip pettinarip added the hacktoberfest Track hacktoberfest activity label Oct 17, 2024
Copy link
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

image

Found some bugs with the colors where we were replicating some bg color styles. Added some commits to clean this up, accounting for both the stand-alone versions (where we style the bg color of the inner container) vs the ones in the modal on the quizzes pages, where the bg color is with the modal.

Patched a few other little color bugs I spotted, and re-deprecated the -neutral color tokens.

image image

Looks ready from my standpoint. Thanks @TylerAPfledderer!

Copy link
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

Awesome @TylerAPfledderer

Left one question about the removed icons from the story but the rest is working perfectly 🏆

@@ -32,20 +31,15 @@ import {
AuditedIcon,
AvadoGlyphIcon,
BattleTestedIcon,
BedrockGlyphIcon,
Copy link
Member

Choose a reason for hiding this comment

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

Why are we taking these icons out of the story? is it a cleanup for something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pettinarip not sure why they were removed. I'll review it as soon as possible!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back those missing icons. Still don't know why they were removed.

listStyleType="none"
sx={{ counterReset: "list-counter" }}
>
<OrderedList className="m-0 list-none [counter-reset:_list-counter]">
Copy link
Member

Choose a reason for hiding this comment

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

til counter-reset

@pettinarip pettinarip merged commit 63b3c8e into ethereum:dev Oct 31, 2024
10 checks passed
@TylerAPfledderer TylerAPfledderer deleted the refactor/shadcn-quiz-widget branch November 2, 2024 14:35
This was referenced Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Track hacktoberfest activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants