Skip to content

Commit

Permalink
Remove borderRadius.none and use 1px in codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Métral committed Jun 16, 2021
1 parent 7616ecf commit 494c4fa
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import styled from '@emotion/styled';
import { css } from '@emotion/core';

const borderRadiusStyles = ({ theme }) => css`
const elementStyles = ({ theme }) => css`
border-top-left-radius: ${theme.borderRadius.mega};
border-top-right-radius: ${theme.borderRadius.giga};
border-bottom-left-radius: ${theme.borderRadius.tera};
border-bottom-right-radius: ${theme.borderRadius.peta};
`;

const removedRadiusStyles = ({ theme }) => css`
border-radius: ${theme.borderRadius.kilo};
`;

const BorderRadius = styled.div(borderRadiusStyles);

const RemovedRadius = styled.div(removedRadiusStyles);
const Element = styled.div(elementStyles);
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import styled from '@emotion/styled';
import { css } from '@emotion/core';

const borderRadiusStyles = ({ theme }) => css`
const elementStyles = ({ theme }) => css`
border-top-left-radius: ${theme.borderRadius.bit};
border-top-right-radius: ${theme.borderRadius.byte};
border-bottom-left-radius: ${theme.borderRadius.byte};
border-bottom-right-radius: ${theme.borderRadius.kilo};
border-radius: ${'1px'};
`;

const removedRadiusStyles = ({ theme }) => css`
border-radius: ${theme.borderRadius.none};
`;

const BorderRadius = styled.div(borderRadiusStyles);

const RemovedRadius = styled.div(removedRadiusStyles);
const Element = styled.div(elementStyles);
4 changes: 3 additions & 1 deletion packages/circuit-ui/cli/migrate/theme-border-radius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const transform: Transform = (file, api) => {
const j = api.jscodeshift;
const root = j(file.source);

renameFactory(j, root, 'kilo', 'none'); // TODO add and deprecate none in design tokens
findProperty(j, root, `theme.borderRadius.kilo`).replaceWith(
j.identifier(`'1px'`),
);
renameFactory(j, root, 'mega', 'bit');
renameFactory(j, root, 'giga', 'byte');
renameFactory(j, root, 'tera', 'byte');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Object {
"circle": "100%",
"kilo": "12px",
"mega": "16px",
"none": "0",
"pill": "999999px",
},
"borderWidth": Object {
Expand Down
1 change: 0 additions & 1 deletion packages/design-tokens/themes/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const iconSizes: IconSizes = {
};

export const borderRadius: BorderRadius = {
none: '0',
bit: '4px',
byte: '8px',
kilo: '12px',
Expand Down
1 change: 0 additions & 1 deletion packages/design-tokens/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export type IconSizes = {
};

export type BorderRadius = {
none: string;
bit: string;
byte: string;
kilo: string;
Expand Down
1 change: 0 additions & 1 deletion packages/design-tokens/utils/theme-prop-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export const themePropType = PropTypes.shape({
giga: PropTypes.string.isRequired,
} as { [key in keyof IconSizes]: any }).isRequired,
borderRadius: PropTypes.shape({
none: PropTypes.string.isRequired,
bit: PropTypes.string.isRequired,
byte: PropTypes.string.isRequired,
kilo: PropTypes.string.isRequired,
Expand Down

0 comments on commit 494c4fa

Please sign in to comment.