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

Create CheckBox component aligned with design system #2838

Closed
wants to merge 8 commits into from

Conversation

nebby2105
Copy link
Contributor

@nebby2105 nebby2105 commented Nov 21, 2024

#2702
Created Checkbox component with the following configurable props:

  1. color (primary, secondary, success, error)
  2. variant (check, middle)
  3. label
  4. labelPosition (top, bottom, end)
  5. size (sm, md, lg)
  6. loading
  7. disabled

Default Parameters:

Color: primary
Variant: check
Size: md
Label Position: end
Loading: false
Disabled: false

Default parameters:
Screenshot 2024-11-21 at 18 17 49

Color="success"
Screenshot 2024-11-21 at 18 16 50

Color="error"
Screenshot 2024-11-21 at 18 17 04

labelPosition="top"
Screenshot 2024-11-21 at 18 17 19

labelPosition="bottom"
Screenshot 2024-11-21 at 18 17 32

  • create CheckBox component
  • add it to storybook
  • cover with tests

nebby2105 and others added 8 commits November 17, 2024 18:11
* fixed header

* fixed styles
* new test implementation of AppButton component

* updated props

* changed structures for design system

* fixed import

* implemented story for Button

* excluded stories from tests and sonar

---------

Co-authored-by: YaroslavChuiko <[email protected]>
* fix: add use memo missing dependencies

* fix: prevent accordion desc text overflow
@nebby2105 nebby2105 added Frontend part feature design system task related to scss design system labels Nov 21, 2024
@nebby2105 nebby2105 self-assigned this Nov 21, 2024
@nebby2105 nebby2105 linked an issue Nov 21, 2024 that may be closed by this pull request

type Ref = MuiButtonProps['ref']

const Button = forwardRef(
Copy link
Contributor

Choose a reason for hiding this comment

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

Add generic types to forwardRef function. So you will not have to type Ref manually. Also props at 40-48 lines will be typed as well.

src/components/check-box/CheckBox.tsx Outdated Show resolved Hide resolved
src/components/check-box/CheckBox.tsx Outdated Show resolved Hide resolved
src/stories/CheckBox.stories.tsx Outdated Show resolved Hide resolved
src/stories/CheckBox.stories.tsx Outdated Show resolved Hide resolved
onChange={handleChange}
/>
)}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

size = 'md',
...props
}) => {
const [checked, setChecked] = useState(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add generic here.
It is a good practice to have generic type in useState hook, even if it has default value

@nebby2105 nebby2105 closed this Nov 21, 2024
@nebby2105
Copy link
Contributor Author

add new pr

@nebby2105 nebby2105 deleted the feature/2702/create-checkbox-component branch November 22, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design system task related to scss design system feature Frontend part
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(SP: 3) Create CheckBox component aligned with design system
5 participants