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

feat(Buttons): Add destructive styles #196

Merged
merged 3 commits into from
Feb 2, 2021
Merged

feat(Buttons): Add destructive styles #196

merged 3 commits into from
Feb 2, 2021

Conversation

maxime-gendron
Copy link
Contributor

@maxime-gendron maxime-gendron commented Jan 15, 2021

PR Description

Ce PR ajoute le bouton destructif pour les components IconButton et Button. J'ai profité de l'occasion pour refactor les styles des boutons qui étaient les même dans les deux components. J'ai ajouté la fonction getButtonTypeStyles() dans le file abstract-button.tsx pour garder ça DRY.

Carte Jira

Questionnement
Les styles sont déjà testés dans les snapshots de Button, donc je me demande si je retire les snapshot tests de styles pour `IconButton?

Tests concernés icon-button.test.tsx:

  • Has disabled styles
  • Has primary styles
  • Has secondary styles
  • Has tertiary styles

Comment on lines +5 to +7
import { AbstractButton, getButtonTypeStyles } from './abstract-button';

type ButtonType = 'primary' | 'secondary' | 'tertiary';
type ButtonType = 'primary' | 'secondary' | 'tertiary' | 'destructive';
Copy link
Contributor

Choose a reason for hiding this comment

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

ButtonType est dupliqué dans AbstractButton

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je fais ça car react-docgen transfert pas les typings via les imports. Ça donne ça dans le Storybook:
image

Au lieu de:
image

C'est un problème qui perdure depuis un moment dans cette lib
reactjs/react-docgen#352 (comment)

`;
}
}}
${getButtonTypeStyles}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ici aussi, ButtonProps duplique buttonType, inversed et theme de AbstractButton au lieu de composer son interface avec.

import { AbstractButton, AbstractButtonProps } from './abstract-button';
import { AbstractButton, getButtonTypeStyles } from './abstract-button';

type ButtonType = 'primary' | 'secondary' | 'tertiary' | 'destructive';
Copy link
Contributor

Choose a reason for hiding this comment

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

Même commentaires pour icon-button

@meriouma
Copy link
Contributor

Ah, et oublie pas de rebaser, sinon ça va 💥

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.

None yet

3 participants