Skip to content

Commit

Permalink
feat: add border types
Browse files Browse the repository at this point in the history
  • Loading branch information
Esthefanie Vila Maior authored and matheushdsbr committed May 22, 2024
1 parent c7386e9 commit 65bb410
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
borderTopRightRadius,
borderBottomLeftRadius,
borderBottomRightRadius,
} from './border';
} from '.';

const borders = [0, 1, 2];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { toPx } from './unit';
import { toPx } from '../unit';
import {
getBorder,
getColor,
getBorderRadius,
generator,
compose,
} from './theme';
} from '../theme';

const transform = value => {
if (Number(value) && value !== 0) {
Expand Down
128 changes: 128 additions & 0 deletions packages/system/src/border/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { borders, colors, radii } from '@gympass/yoga-tokens';

type BorderValues = typeof borders | number | string;
type BorderColorsValues = typeof colors | string;
type BorderRadiusValues = typeof radii | number | string;

type Border = {
border?: BorderValues;
b?: BorderValues;
};

type BorderTop = {
borderTop?: BorderValues;
bt?: BorderValues;
};

type BorderRight = {
borderRight?: BorderValues;
br?: BorderValues;
};

type BorderBottom = {
borderBottom?: BorderValues;
bb?: BorderValues;
};

type BorderLeft = {
borderLeft?: BorderValues;
bl?: BorderValues;
};

type BorderColor = {
borderColor?: BorderColorsValues;
bc?: BorderColorsValues;
};

type BorderTopColor = {
borderTopColor?: BorderColorsValues;
btc?: BorderColorsValues;
};

type BorderRightColor = {
borderRightColor?: BorderColorsValues;
brc?: BorderColorsValues;
};

type BorderBottomColor = {
borderBottomColor?: BorderColorsValues;
bbc?: BorderColorsValues;
};

type BorderLeftColor = {
borderLeftColor?: BorderColorsValues;
blc?: BorderColorsValues;
};

type BorderWidth = {
borderWidth?: BorderValues;
bw?: BorderValues;
};

type BorderTopWidth = {
borderTopWidth?: BorderValues;
btw?: BorderValues;
};

type BorderRightWidth = {
borderRightWidth?: BorderValues;
brw?: BorderValues;
};

type BorderBottomWidth = {
borderBottomWidth?: BorderValues;
bbw?: BorderValues;
};

type BorderLeftWidth = {
borderLeftWidth?: BorderValues;
blw?: BorderValues;
};

type BorderRadius = {
borderRadius?: BorderRadiusValues;
bRadius?: BorderRadiusValues;
};

type BorderTopLeftRadius = {
borderTopLeftRadius?: BorderRadiusValues;
btlr?: BorderRadiusValues;
};

type BorderTopRightRadius = {
borderTopRightRadius?: BorderRadiusValues;
btrr?: BorderRadiusValues;
};

type BorderBottomLeftRadius = {
borderBottomLeftRadius?: BorderRadiusValues;
bblr?: BorderRadiusValues;
};

type BorderBottomRightRadius = {
borderBottomRightRadius?: BorderRadiusValues;
bbrr?: BorderRadiusValues;
};

export type Borders = {
borderStyle?: string;
} & Border &
BorderTop &
BorderRight &
BorderBottom &
BorderLeft &
BorderColor &
BorderTopColor &
BorderRightColor &
BorderBottomColor &
BorderLeftColor &
BorderWidth &
BorderTopWidth &
BorderRightWidth &
BorderBottomWidth &
BorderLeftWidth &
BorderRadius &
BorderTopLeftRadius &
BorderTopRightRadius &
BorderBottomLeftRadius &
BorderBottomRightRadius;
1 change: 1 addition & 0 deletions packages/tokens/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ import znCn from './locale/zn-cn';
import { BreakpointsKey, BreakpointsType } from './global/breakpoints';

export { tokens as default, znCn, BreakpointsKey, BreakpointsType };
export * from './global'

0 comments on commit 65bb410

Please sign in to comment.