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

Checkbox and Switch UI #12

Closed
wants to merge 13 commits into from
Closed

Conversation

TDonks
Copy link

@TDonks TDonks commented May 21, 2024

UI for checkbox and switch added to src/components

@TDonks TDonks requested review from doubleedesign and a team as code owners May 21, 2024 13:35
Copy link
Contributor

@doubleedesign doubleedesign left a comment

Choose a reason for hiding this comment

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

Great start! Some fairly minor tweaks to address, but this is coming along nicely.

${props => props.$appearance === 'outline' ? `
background: ${props.theme.colors[props.$color]};
` : `
background: ${shade(0.15, props.theme.colors[props.$color])};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work using the theming and Polished colour functions!

import { render, screen } from '@testing-library/react';
import Checkbox from './Checkbox';

describe('<Checkbox />', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can wait until next tri, but it would be good to have some more extensive tests here e.g., selecting and deselecting

$size: ThemeElementSize;
};

export const StyledCheckbox = styled.button<StyledButtonProps>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Semantically, a checkbox should be an input checkbox, not a button. Guessing you did it this way because options for styling actual checkboxes are pretty limited; you can get around this with some trickery using pseudo-elements. Here's a resource with examples: https://css-tricks.com/the-checkbox-hack/

onClick,
appearance = 'solid',
size = 'md'
}) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we know if the switch is on or off? It should probably have a boolean state value or something like that, which gets toggled on click. It's not enough for it to look on or off, because its value would be used somewhere in the application.

import { render, screen } from '@testing-library/react';
import Switch from './Switch';

describe('<Switch />', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Like the checkbox, it would be good to have tests for the different switch states. But this can wait until next tri. :)

@ben-AI-cybersec
Copy link
Member

Changes not addressed, closing PR

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