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(components): migrate Toggle to TypeScript #628

Merged
merged 4 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ The affected components are: Badge, Blockquote, Button, ButtonGroup, Card, CardF
- The `plain` **Button** prop has been removed. Use the new Anchor component or the `tertiary` Button variant instead.
- The `flat` **Button** variant has been removed (🤖 _button-variant-enum_)
- The **LoadingButton**'s exit animations have been removed. An action's success or error result should be communicated outside the button (🤖 _exit-animations_)
- The **RadioButton** and **Switch** components no longer accept the `onToggle` prop. Use the `onChange` prop instead (🤖 _onchange-prop_)
- The **RadioButton** and **Switch** component's `onToggle` prop has been renamed to `onChange` (🤖 _onchange-prop_)
- The **Input** and **Textarea** components no longer accept `*ClassName` props. Emotion 10 uses style objects instead of class names. Use the `*Styles` props instead. The `wrapperStyles` prop has been renamed to `labelStyles` (🤖 _input-label-styles-prop_). The `deepRef` prop has been renamed to `ref` (🤖 _input-deepref-prop_)
- The **Input** and **Textarea** components' `deepRef` prop has been renamed to `ref` (🤖 _input-deepref-prop_)
- The **Input** and **Textarea** components no longer have an `optional` state. Add "(optional)" to the label text instead.
- The **Selector** component no longer accepts the `onClick` and `selected` props. Use the `onChange` and `checked` props instead (🤖 _selector-props_). The `value` and `name` have been added as required props.
- The **Selector** component's `onClick` and `selected` props have been renamed to `onChange` and `checked` (🤖 _selector-props_). The `value` and `name` have been added as required props.
- The **Toggle** component's `on`, `labelOn`, and `labelOff` props have been renamed to `checked`, `labelChecked`, and `labelUnchecked` (🤖 _toggle-checked-prop_).
- The **RadioButtonGroup** component's `label` property inside the `options` prop has been renamed to `children`.
- The **IconButton** component's dimensions and style have changed. It is now consistent with the Button component.
- The **Hamburger** component's default size has been increased to match the IconButton component.
Expand Down
79 changes: 39 additions & 40 deletions scripts/static-styles/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ import React from 'react';
import { entries, isFunction, kebabCase } from 'lodash/fp';
import { light } from '@sumup/design-tokens';

import {
// Badge,
ButtonGroup,
Card,
Checkbox,
Hr,
Image,
// Input,
// Label,
RadioButton,
// Select,
// Selector,
Tag,
// TextArea,
Toggle
} from '../../src';
// import {
connor-baer marked this conversation as resolved.
Show resolved Hide resolved
// Badge,
// ButtonGroup,
// Card,
// Checkbox,
// Hr,
// Image,
// Input,
// Label,
// RadioButton,
// Select,
// Selector,
// Tag,
// TextArea,
// Toggle
// } from '../../src';

const element = props => <div {...props} />;

Expand Down Expand Up @@ -111,9 +111,9 @@ export function getComponentInfo(component, propOverrides = {}) {
}
}

// TODO: Make React DocGen work with TypeScript
export default {
themes: { light },
// TODO: Make React DocGen work with TypeScript
components: [
// {
// name: 'badge',
Expand All @@ -125,20 +125,20 @@ export default {
// },
// getComponentInfo(Button, { size: [KILO, MEGA] }),
// getComponentInfo(Blockquote, {
// size: [Blockquote.KILO, Blockquote.MEGA, Blockquote.GIGA]
// size: ['kilo', 'mega', 'giga']
// }),
// getComponentInfo(ButtonGroup, {
// align: ['left', 'center', 'right']
// }),
getComponentInfo(ButtonGroup, {
align: [ButtonGroup.LEFT, ButtonGroup.CENTER, ButtonGroup.RIGHT]
}),
{
name: 'card',
component: Card,
props: {
shadow: [Card.SINGLE, Card.DOUBLE, Card.TRIPLE],
spacing: [Card.MEGA, Card.GIGA]
}
},
getComponentInfo(Checkbox),
// {
// name: 'card',
// component: Card,
// props: {
// shadow: ['single', 'double', 'triple'],
// spacing: ['mega', 'giga']
// }
// },
// getComponentInfo(Checkbox),
// getComponentInfo(Hamburger),
// getComponentInfo(Heading, {
// size: [
Expand All @@ -151,8 +151,8 @@ export default {
// "zetta"
// ]
// }),
{ name: 'hr', component: Hr },
{ name: 'image', component: Image },
// { name: 'hr', component: Hr },
// { name: 'image', component: Image },
// getComponentInfo(Input, {
// renderPrefix: PropTypes.element,
// renderSuffix: PropTypes.element,
Expand All @@ -166,24 +166,23 @@ export default {
// getComponentInfo(ProgressBar, {
// size: ['kilo', 'mega', 'giga']
// }),
getComponentInfo(RadioButton),
// getComponentInfo(RadioButton),
// getComponentInfo(Select, {
// renderPrefix: PropTypes.element
// }),
// { name: 'selector', component: Selector },
// TODO: Make React DocGen work with TypeScript
// getComponentInfo(SubHeading, {
// size: ['kilo', 'mega']
// }),
getComponentInfo(Tag, {
onRemove: PropTypes.func,
prefix: PropTypes.element,
suffix: PropTypes.element
}),
// getComponentInfo(Tag, {
// onRemove: PropTypes.func,
// prefix: PropTypes.element,
// suffix: PropTypes.element
// }),
// getComponentInfo(Text, {
// size: ['kilo', 'mega', 'giga']
// }),
// getComponentInfo(TextArea),
getComponentInfo(Toggle)
// getComponentInfo(Toggle)
]
};
Loading