Skip to content

Commit

Permalink
Merge pull request #816 from gympass/DS-841
Browse files Browse the repository at this point in the history
🚀 feat(system): add types to spacing
  • Loading branch information
evilamaior authored May 28, 2024
2 parents efaef01 + 17fe0e0 commit 713db56
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/system/src/spacing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './spacing';
export type { Spacing } from './types';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toPx } from './unit';
import { getSpacing, generator, compose } from './theme';
import { toPx } from '../unit';
import { getSpacing, generator, compose } from '../theme';

const margin = props =>
generator({
Expand Down
128 changes: 128 additions & 0 deletions packages/system/src/spacing/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { spacing } from '@gympass/yoga-tokens';

type SpacingValues = typeof spacing | number | string;

type Margin = {
margin?: SpacingValues;
m?: SpacingValues;
};

type MarginTop = {
marginTop?: SpacingValues;
mt?: SpacingValues;
};

type MarginRight = {
marginRight?: SpacingValues;
mr?: SpacingValues;
};

type MarginBottom = {
marginBottom?: SpacingValues;
mb?: SpacingValues;
};

type MarginLeft = {
marginLeft?: SpacingValues;
ml?: SpacingValues;
};

type MarginHorizontal = {
marginHorizontal?: SpacingValues;
mx?: SpacingValues;
mh?: SpacingValues;
};

type MarginVertical = {
marginVertical?: SpacingValues;
my?: SpacingValues;
mv?: SpacingValues;
};

type Padding = {
padding?: SpacingValues;
p?: SpacingValues;
};

type PaddingTop = {
paddingTop?: SpacingValues;
pt?: SpacingValues;
};

type PaddingRight = {
paddingRight?: SpacingValues;
pr?: SpacingValues;
};

type PaddingBottom = {
paddingBottom?: SpacingValues;
pb?: SpacingValues;
};

type PaddingLeft = {
paddingLeft?: SpacingValues;
pl?: SpacingValues;
};

type PaddingHorizontal = {
paddingHorizontal?: SpacingValues;
px?: SpacingValues;
ph?: SpacingValues;
};

type PaddingVertical = {
paddingVertical?: SpacingValues;
py?: SpacingValues;
pv?: SpacingValues;
};

type Width = {
width?: SpacingValues;
w?: SpacingValues;
};

type MaxWidth = {
maxWidth?: SpacingValues;
maxW?: SpacingValues;
};

type MinWidth = {
minWidth?: SpacingValues;
minW?: SpacingValues;
};

type Height = {
height?: SpacingValues;
h?: SpacingValues;
};

type MaxHeight = {
maxHeight?: SpacingValues;
maxH?: SpacingValues;
};

type MinHeight = {
minHeight?: SpacingValues;
minH?: SpacingValues;
};

export type Spacing = Margin &
MarginTop &
MarginRight &
MarginBottom &
MarginLeft &
MarginHorizontal &
MarginVertical &
Padding &
PaddingTop &
PaddingRight &
PaddingBottom &
PaddingLeft &
PaddingHorizontal &
PaddingVertical &
Width &
MaxWidth &
MinWidth &
Height &
MaxHeight &
MinHeight;

0 comments on commit 713db56

Please sign in to comment.