-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add "Building design system components" guide with Pigment CSS (…
- Loading branch information
1 parent
1e8beab
commit 1e11691
Showing
5 changed files
with
430 additions
and
0 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
53 changes: 53 additions & 0 deletions
53
packages/pigment-css-react/tests/theme/fixtures/themed-component.input.js
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,53 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@pigment-css/react'; | ||
|
||
const StatRoot = styled('div', { | ||
name: 'PigmentStat', // The component name | ||
slot: 'root', // The slot name | ||
})(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: '1rem', | ||
padding: '0.75rem 1rem', | ||
backgroundColor: theme.colors.primary.background, | ||
borderRadius: theme.radius.xs, | ||
boxShadow: theme.shadow.sm, | ||
letterSpacing: '-0.025em', | ||
fontWeight: 600, | ||
variants: [ | ||
{ | ||
props: { variant: 'outlined' }, | ||
style: { | ||
border: `2px solid #e9e9e9`, | ||
}, | ||
}, | ||
], | ||
})); | ||
|
||
const StatValue = styled('div', { | ||
name: 'PigmentStat', | ||
slot: 'value', | ||
})(({ theme }) => ({ | ||
...theme.typography.h3, | ||
})); | ||
|
||
const StatUnit = styled('div', { | ||
name: 'PigmentStat', | ||
slot: 'unit', | ||
})(({ theme }) => ({ | ||
...theme.typography.body2, | ||
color: theme.colors.neutral.foreground, | ||
})); | ||
|
||
const Stat = React.forwardRef(function Stat(props, ref) { | ||
const { value, unit, ...other } = props; | ||
|
||
return ( | ||
<StatRoot ref={ref} {...other}> | ||
<StatValue>{value}</StatValue> | ||
<StatUnit>{unit}</StatUnit> | ||
</StatRoot> | ||
); | ||
}); | ||
|
||
export default Stat; |
21 changes: 21 additions & 0 deletions
21
packages/pigment-css-react/tests/theme/fixtures/themed-component.output.css
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,21 @@ | ||
.si9gu6v { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
padding: 0.75rem 1rem; | ||
background-color: #ebf5ff; | ||
border-radius: 0.25rem; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); | ||
letter-spacing: -0.025em; | ||
font-weight: 600; | ||
} | ||
.si9gu6v-1 { | ||
border: 2px solid #e9e9e9; | ||
} | ||
.sbfbm5t { | ||
font-size: 2rem; | ||
} | ||
.s1xscf0o { | ||
font-size: 1rem; | ||
color: #6f7f95; | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/pigment-css-react/tests/theme/fixtures/themed-component.output.js
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,44 @@ | ||
import { styled as _styled3 } from '@pigment-css/react'; | ||
import _theme3 from '@pigment-css/react/theme'; | ||
import { styled as _styled2 } from '@pigment-css/react'; | ||
import _theme2 from '@pigment-css/react/theme'; | ||
import { styled as _styled } from '@pigment-css/react'; | ||
import _theme from '@pigment-css/react/theme'; | ||
import * as React from 'react'; | ||
const StatRoot = /*#__PURE__*/ _styled('div', { | ||
name: 'PigmentStat', | ||
// The component name | ||
slot: 'root', // The slot name | ||
})({ | ||
classes: ['si9gu6v'], | ||
variants: [ | ||
{ | ||
props: { | ||
variant: 'outlined', | ||
}, | ||
className: 'si9gu6v-1', | ||
}, | ||
], | ||
}); | ||
const StatValue = /*#__PURE__*/ _styled2('div', { | ||
name: 'PigmentStat', | ||
slot: 'value', | ||
})({ | ||
classes: ['sbfbm5t'], | ||
}); | ||
const StatUnit = /*#__PURE__*/ _styled3('div', { | ||
name: 'PigmentStat', | ||
slot: 'unit', | ||
})({ | ||
classes: ['s1xscf0o'], | ||
}); | ||
const Stat = React.forwardRef(function Stat(props, ref) { | ||
const { value, unit, ...other } = props; | ||
return ( | ||
<StatRoot ref={ref} {...other}> | ||
<StatValue>{value}</StatValue> | ||
<StatUnit>{unit}</StatUnit> | ||
</StatRoot> | ||
); | ||
}); | ||
export default Stat; |
Oops, something went wrong.