-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): Add fluid tokens for spacing and typo (#88)
- Loading branch information
Showing
82 changed files
with
2,197 additions
and
1,218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;1,400;1,500&display=swap" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500&display=swap" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ResponsiveValue, system } from '../system'; | ||
import { BorderRadiusSizes } from '../../theme/shape'; | ||
import { PabloTheme } from '../../theme/types'; | ||
import { calculateFluidClamp, ensureFluidTuple } from '../../styleHelpers/fluidClamp'; | ||
|
||
type BorderRadiusInput = BorderRadiusSizes | string | number; | ||
|
||
export interface ShapeProps { | ||
borderRadius?: ResponsiveValue<BorderRadiusInput>; | ||
br?: ResponsiveValue<BorderRadiusInput>; | ||
} | ||
|
||
const borderRadiusTransform = (value: BorderRadiusInput, theme: PabloTheme) => { | ||
const borderRadius = theme.shape.borderRadius[value as BorderRadiusSizes] || value; | ||
if (typeof borderRadius === 'string') { | ||
return borderRadius; | ||
} | ||
const [minSize, maxSize] = ensureFluidTuple(borderRadius); | ||
return calculateFluidClamp(minSize, maxSize, theme.fluid.minScreen, theme.fluid.maxScreen); | ||
}; | ||
|
||
const shape = system([ | ||
{ | ||
properties: ['borderRadius'], | ||
fromProps: ['borderRadius', 'br'], | ||
transform: borderRadiusTransform, | ||
as: 'type', | ||
}, | ||
]); | ||
|
||
export { shape, borderRadiusTransform }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.