Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Style System #5

Merged
merged 34 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f18571a
style system
alexasselin008 Oct 4, 2023
9ac8af1
Merge branch 'feature/remove_theming' into feature/style_system
alexasselin008 Oct 4, 2023
64c3a4a
fix token values
alexasselin008 Oct 6, 2023
c0abc2e
fix tokens
alexasselin008 Oct 6, 2023
3c55141
fix grid stories
alexasselin008 Oct 6, 2023
9c94ac9
update failing tests
alexasselin008 Oct 6, 2023
dd50d06
Merge branch 'master' into feature/style_system
alexasselin008 Oct 6, 2023
b026c3e
add missing handlers + fix fontweight handler
alexasselin008 Oct 6, 2023
4b99ee3
update tokens to remove suffix and prefix from keys
alexasselin008 Oct 11, 2023
07d8baf
Merge branch 'master' into feature/style_system
alexasselin008 Oct 11, 2023
5025af7
fix doc
alexasselin008 Oct 11, 2023
ed81707
update snapshots
alexasselin008 Oct 11, 2023
eff2052
fix some spacing that were changed with the wrong values
alexasselin008 Oct 12, 2023
137b692
fix some sizes
alexasselin008 Oct 12, 2023
03d19c4
fix failing chromatic tests
alexasselin008 Oct 12, 2023
8862f6e
fix missed variables
alexasselin008 Oct 12, 2023
207f0d4
fixed missing tokens
alexasselin008 Oct 12, 2023
ed5e720
fix broken tokens
alexasselin008 Oct 12, 2023
76f91ec
Merge branch 'master' into feature/style_system
alexasselin008 Oct 12, 2023
1deba80
fix tests
alexasselin008 Oct 13, 2023
33eeb4d
Merge branch 'master' into feature/style_system
alexasselin008 Oct 13, 2023
1ffa0eb
fix toolbar
alexasselin008 Oct 13, 2023
d4da541
fix documentation
alexasselin008 Oct 13, 2023
28ef0b2
fix spacing
alexasselin008 Oct 13, 2023
c4da047
fix last test
alexasselin008 Oct 13, 2023
e7aaa3b
fix tokens in doc
alexasselin008 Oct 13, 2023
d201e31
fix doc example
alexasselin008 Oct 13, 2023
597b7d2
fix doc example
alexasselin008 Oct 13, 2023
9047abf
update documentation
alexasselin008 Oct 13, 2023
bf60a25
change px to rem
alexasselin008 Oct 13, 2023
3ca626f
Merge branch 'master' into feature/style_system
alexasselin008 Oct 13, 2023
0d1c317
Merge branch 'master' into feature/style_system
alexasselin008 Oct 13, 2023
47fb3a1
fix merge conflicts
alexasselin008 Oct 13, 2023
075413c
update snapshots
alexasselin008 Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export function CheckeredBackground({ children, ...rest }: DivProps) {
{...mergeProps(
rest,
{
color: "alias-primary",
paddingLeft: 2,
color: "neutral",
paddingLeft: 80,
className: "o-ui-sb-checkered-background-preview"
}
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ExperimentalMessage({ noDoc, noTests, noVisualTesting, noFinalDe
const hasDetails = [noDoc, noTests, noVisualTesting, noFinalDesign, noMobileSupport].some(validation => validation);

return (
<Message variant="negative" fontSize={4} {...rest}>
<Message variant="negative" fontSize={160} {...rest}>
<Content>
<Heading>Experimental</Heading>
<Text size="lg">
Expand Down
2 changes: 1 addition & 1 deletion .storybook/components/github-link/GithubLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function GithubLink({ path, logo = false, children, ...rest }: GithubLink
if (logo) {
return (
<Flex inline alignItems="center">
<Img src={GithubLogo} alt="Github" width={5} height={5} marginRight={2} />
<Img src={GithubLogo} alt="Github" width={320} height={320} marginRight={80} />
<ExternalLink href={getGithubUrl(path)} {...rest}>{children}</ExternalLink>
</Flex>
);
Expand Down
2 changes: 1 addition & 1 deletion .storybook/decorators/withCenteredCanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function withCenteredCanvas(story, context) {
top="0"
left="0"
right="0"
marginTop={10}
marginTop="3.5rem"
alignItems="center"
>
<Div
Expand Down
8 changes: 4 additions & 4 deletions docs/features/ResponsiveStyles.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Orbiter [style props](?path=/docs/style-props--page) accepts a specialized synta
By passing an object to any style props, you can specify which style will be applied at different breakpoints. These rules are on a [`min-width` basis](https://nikitahl.com/difference-between-min-width-vs-max-width) meaning that a `sm` value will apply from `768px` and up until another higher breakpoint matches.

<Preview>
<Div backgroundColor={{ base: "green-2", xs: "purple-2", sm: "green-2", md: "accent-2", lg: "neutral-2", xl: "warning-2" }} width={18} maxWidth="100%" padding={4}>
<Paragraph fontSize={4}>Lost in space.</Paragraph>
<Div backgroundColor={{ base: "moss-200", xs: "sapphire-200", sm: "moss-200", md: "sapphire-200", lg: "rock-200", xl: "sunken-treasure-200" }} width="30rem" maxWidth="100%" padding={160}>
<Paragraph fontSize={160}>Lost in space.</Paragraph>
</Div>
</Preview>

Expand All @@ -26,8 +26,8 @@ By passing an object to any style props, you can specify which style will be app
Not all breakpoints must be explicitly defined. In the following example, `base` and `lg` breakpoints are explicitly declared. When match, the `xl` breakpoint will implicitly take the value set by the `lg` breakpoint since it is wider than `lg`. Everything below `lg` inherits the `base` color.

<Preview>
<Div backgroundColor={{ base: "alias-success", lg: "alias-warning" }} width={18} maxWidth="100%" padding={4}>
<Paragraph fontSize={4}>Lost in space.</Paragraph>
<Div backgroundColor={{ base: "success", lg: "warning" }} width="30rem" maxWidth="100%" padding={160}>
<Paragraph fontSize={160}>Lost in space.</Paragraph>
</Div>
</Preview>

Expand Down
2 changes: 1 addition & 1 deletion docs/features/color-schemes/ColorSchemeToggle.sample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ render(() => {

return (
<ThemeProvider colorScheme={parentColorScheme}>
<Div backgroundColor="alias-surface" padding={2}>
<Div backgroundColor="neutral" padding={2}>
<ColorSchemeToggle />
</Div>
</ThemeProvider>
Expand Down
8 changes: 4 additions & 4 deletions docs/features/style-props/PropsReferenceTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const propTypes = {
};

const ScaleLinks = {
"box-shadow-scale": <Link href="?path=/docs/tokens--page#box-shadows">1..4 / alias</Link>,
"color-scale": <Link href="?path=/docs/tokens--page#background-colors">[color]-[1..10] / alias</Link>,
"sizing-scale": <Link href="?path=/docs/tokens--page#sizings">1..18</Link>,
"spacing-scale": <Link href="?path=/docs/tokens--page#spacings">1..13</Link>
"box-shadow-scale": <Link href="https://wl-hopper.netlify.app/tokens/semantic/shadow">shadows</Link>,
"color-scale": <Link href="https://wl-hopper.netlify.app/tokens/semantic/color">colors</Link>,
"sizing-scale": <Link href="https://wl-hopper.netlify.app/tokens/semantic/dimensions">Dimensions</Link>,
"spacing-scale": <Link href="https://wl-hopper.netlify.app/tokens/semantic/dimensions">Dimensions</Link>
};

function toScaleLink(scale) {
Expand Down
50 changes: 25 additions & 25 deletions docs/features/style-props/StyleProps.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ To apply a style value, set a value to any [style property](#properties) of an O

```jsx
<Div
fontSize={6}
fontWeight={3}
paddingTop={3}
paddingBottom={3}
marginBottom={3}
color="alias-static-white"
borderRadius={3}
backgroundColor="alias-accent">
fontSize="1.375rem"
fontWeight={680}
paddingTop={160}
paddingBottom={160}
marginBottom={160}
color="samoyed"
borderRadius="rounded-md"
backgroundColor="primary">
Lost in space.
</Div>
```
Expand All @@ -38,8 +38,8 @@ Props like `border` and `paddingX` are also provided to help you save keystrokes

```jsx
<Div
paddingY={3}
border="alias-accent">
paddingY={80}
border="primary">
Lost in space.
</Div>
```
Expand All @@ -53,8 +53,8 @@ Inspired by [Styled System](https://styled-system.com/), Orbiter's style props a
To help achieve a consistent user interface, Orbiter style props are based on scales and values defined in a customizable [theme](?path=/docs/theming--page).

<Preview>
<Div width={18} backgroundColor="alias-accent-light" padding={4} borderRadius={2} maxWidth="100%">
<Paragraph fontSize={4}>Lost in space.</Paragraph>
<Div width="30rem" backgroundColor="primary-weak" padding={160} borderRadius="rounded-md" maxWidth="100%">
<Paragraph fontSize={160}>Lost in space.</Paragraph>
</Div>
</Preview>

Expand Down Expand Up @@ -84,8 +84,8 @@ Since the following user action pseudo-classes are often used, some style props
> Not all style props supports user action pseudo-classes. Find out which props support user action pseudo-classes in the [reference](#properties) section.

<Preview>
<Div backgroundColorHover="alias-success-light" backgroundColor="alias-warning-light" padding={4} width={18} maxWidth="100%" borderRadius={2}>
<Paragraph fontSize={4}>Lost in space.</Paragraph>
<Div backgroundColorHover="status-positive" backgroundColor="warning-weak" padding={160} width="30rem" maxWidth="100%" borderRadius="rounded-md">
<Paragraph fontSize={160}>Lost in space.</Paragraph>
</Div>
</Preview>

Expand All @@ -106,11 +106,11 @@ To facilitate layouts, Orbiter provides specialized components for [grid](https:
When applicable, always prefer using a [`<Grid>`](?path=/docs/grid--areas) or [`<Flex>`](?path=/docs/flex--horizontal) component instead of a [`<Div>`](?path=/docs/html-div--example) component.

```jsx
<Grid templateColumns="1fr 1fr" gap={2} height={10}>
<Div backgroundColor="accent-5" />
<Div backgroundColor="alert-5" />
<Div backgroundColor="green-5" />
<Div backgroundColor="neutral-5" />
<Grid templateColumns="1fr 1fr" gap={80} height={800}>
<Div backgroundColor="sapphire-500" />
<Div backgroundColor="amanita-500" />
<Div backgroundColor="moss-500" />
<Div backgroundColor="rock-500" />
</Grid>
```

Expand Down Expand Up @@ -163,7 +163,7 @@ The following tables provide a list of all available style props by category.
### Space

```jsx
<Div padding={4}>
<Div padding={160}>
Galaxy
</Div>
```
Expand Down Expand Up @@ -191,7 +191,7 @@ The following tables provide a list of all available style props by category.
### Color

```jsx
<Text backgroundColor="alias-accent-faint" color="alias-static-white">
<Text backgroundColor="primary-weak" color="#FFFFFF">
Galaxy
</Text>
```
Expand Down Expand Up @@ -233,7 +233,7 @@ The following tables provide a list of all available style props by category.
### Layout

```jsx
<Div width={18}>
<Div width="30rem">
Galaxy
</Div>
```
Expand Down Expand Up @@ -344,8 +344,8 @@ The following tables provide a list of all available style props by category.

```jsx
<Div
border={1}
borderRadius={2}
border="primary"
borderRadius="rounded-md"
>
Rocket
</Div>
Expand Down Expand Up @@ -395,7 +395,7 @@ Border props (border, borderBottom, borderTop, borderRight, borderLeft) uses an

```jsx
<Div
boxShadow="alias-lifted"
boxShadow="lifted"
/>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/features/tokens/ColorPaletteTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function toRowValues({ value, variable, color }) {
value,
variable,
color,
<Div backgroundColor={value} height={6}></Div>
<Div backgroundColor={value} height={400}></Div>
];
}

Expand Down
34 changes: 17 additions & 17 deletions docs/features/tokens/TokenTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,50 +52,50 @@ export function TokenTable({ colors }) {
}

export function backgroundRenderer(token) {
return <Div height={6} backgroundColor={token}></Div>;
return <Div height={400} backgroundColor={token}></Div>;
}

export function borderRenderer(token) {
return <Div padding={2}><Div height={6} border={token}></Div></Div>;
return <Div padding={2}><Div height={400} border={token}></Div></Div>;
}

export function boxShadowRenderer(token) {
return <Div paddingRight={4}><Div boxShadow={token} marginY={3} height={6}></Div></Div>;
return <Div paddingRight={160}><Div boxShadow={token} marginY="0.75rem" height={400}></Div></Div>;
}

export function durationRenderer() {
return <Div paddingRight={4}><Div marginY={3} height={6}></Div></Div>;
return <Div paddingRight={160}><Div marginY="0.75rem" height={400}></Div></Div>;
}

export function easingRenderer() {
return <Div paddingRight={4}><Div marginY={3} height={6}></Div></Div>;
return <Div paddingRight={160}><Div marginY="0.75rem" height={400}></Div></Div>;
}

export function fontSizeRenderer(token) {
return <Div height={12} display="flex" alignItems="center" justifyContent="start"><Text fontSize={token} lineHeight={1}>Ag</Text></Div>;
return <Div height={960} display="flex" alignItems="center" justifyContent="start"><Text fontSize={token} lineHeight={1}>Ag</Text></Div>;
}

export function fontWeightRenderer(token) {
return <Flex height={5} alignItems="center"><Text fontWeight={token} fontSize={6} lineHeight={1}>Ag</Text></Flex>;
return <Flex height={320} alignItems="center"><Text fontWeight={token} fontSize="1.375rem" lineHeight={1}>Ag</Text></Flex>;
}

export function iconRenderer(token) {
if (token === "alias-static-white") {
return <Div height={6} display="flex" alignItems="center" justifyContent="start" backgroundColor="#272626"><InfoCircleMajorIcon fill={token} /></Div>;
if (token === "samoyed") {
return <Div height={400} display="flex" alignItems="center" justifyContent="start" backgroundColor="#272626"><InfoCircleMajorIcon fill={token} /></Div>;
} else {
return <Div height={6} display="flex" alignItems="center" justifyContent="start"><InfoCircleMajorIcon fill={token} /></Div>;
return <Div height={400} display="flex" alignItems="center" justifyContent="start"><InfoCircleMajorIcon fill={token} /></Div>;
}
}

export function lineHeightRenderer(token) {
return <Div display="inline-block" paddingX={2} lineHeight={token} borderRadius={2}><Span lineHeight={token}>Ag</Span></Div>;
return <Div display="inline-block" paddingX={80} lineHeight={token} borderRadius="rounded-md"><Span lineHeight={token}>Ag</Span></Div>;
}

export function radiiRenderer(token) {
if (token === "circular") {
return <Div height={4} width={4} borderRadius={token} border="alias-accent"></Div>;
return <Div height={240} width={240} borderRadius={token} border="primary"></Div>;
} else {
return <Div height={4} width={8} borderRadius={token} border="alias-accent"></Div>;
return <Div height={240} width="3.5rem" borderRadius={token} border="primary"></Div>;
}
}

Expand All @@ -104,14 +104,14 @@ export function sizingRenderer() {
}

export function spacingRenderer(token) {
return <Div height={4} width={token} backgroundColor="alias-accent" borderRadius={2}></Div>;
return <Div height={240} width={token} backgroundColor="primary" borderRadius="rounded-md"></Div>;
}

export function textRenderer(token) {
if (token === "alias-static-white") {
return <Div height={6} display="flex" alignItems="center" justifyContent="start" backgroundColor="#272626"><Text marginLeft={1} color={token} size="lg">Moon</Text></Div>;
if (token === "#FFFFFF" || token === "samoyed") {
return <Div height={400} display="flex" alignItems="center" justifyContent="start" backgroundColor="#272626"><Text marginLeft={40} color={token} size="lg">Moon</Text></Div>;
} else {
return <Div height={6} display="flex" alignItems="center" justifyContent="start"><Text marginLeft={1} color={token} size="lg">Moon</Text></Div>;
return <Div height={400} display="flex" alignItems="center" justifyContent="start"><Text marginLeft={40} color={token} size="lg">Moon</Text></Div>;
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/Installation.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ You're all set! You can start creating your application with Orbiter:
import { Div, Text } from "@workleap/orbiter-ui";

export const App = () => (
<Div backgroundColor="alias-warning">
<Text color="alias-primary">Hello World!</Text>
<Div backgroundColor="warning">
<Text color="neutral">Hello World!</Text>
</Div>
);
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function SelectedHeader({ header, children, ...rest }) {
return (
<AccordionHeader
{...rest}
color={expandedKeys.includes(key) ? "accent-7" : undefined}
color={expandedKeys.includes(key) ? "sapphire-700" : undefined}
header={header}
headingType={H3}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ stories()
)
.add("styling", () =>
<Inline>
<Accordion border="warning-7" expandedKeys={["0"]}>
<Accordion border="warning" expandedKeys={["0"]}>
<Item>
<H3 border="warning-7">Mars</H3>
<Content border="warning-7">Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System.</Content>
<H3 border="warning">Mars</H3>
<Content border="warning">Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System.</Content>
</Item>
</Accordion>
<Accordion className="border-red" expandedKeys={["0"]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ stories()
.add("styled system", () =>
<Alert
primaryButtonLabel="Yes"
border="warning-7"
border="warning"
>
<Heading border="warning-7">Launch</Heading>
<Content border="warning-7">Are you sure you want to launch the space shuttle?</Content>
<Heading border="warning">Launch</Heading>
<Content border="warning">Are you sure you want to launch the space shuttle?</Content>
</Alert>
)
.add("className", () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const TriggerStates: AutocompleteStory = {
export const NoResults: AutocompleteStory = {
storyName: "no results",
render: () => (
<Stack gap={13}>
<Stack gap={800}>
<Inline>
<Autocomplete defaultOpen placeholder="Select a planet" aria-label="Planets">
<Item key="earth">Earth</Item>
Expand Down Expand Up @@ -402,7 +402,7 @@ export const NoResults: AutocompleteStory = {
export const CustomTriggerWidth: AutocompleteStory = {
storyName: "custom trigger width",
render: () => (
<Autocomplete width={16} placeholder="Select a planet" aria-label="Planets">
<Autocomplete width="20rem" placeholder="Select a planet" aria-label="Planets">
<Item key="earth">Earth</Item>
<Item key="mars">Mars</Item>
<Item key="saturn">Saturn</Item>
Expand Down Expand Up @@ -506,7 +506,7 @@ export const Styling: AutocompleteStory = {
storyName: "styling",
render: () => (
<Inline>
<Autocomplete border="warning-7" placeholder="Select a planet" aria-label="Planets">
<Autocomplete border="warning" placeholder="Select a planet" aria-label="Planets">
<Item key="earth">Earth</Item>
<Item key="jupiter">Jupiter</Item>
<Item key="mars">Mars</Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const Styling: AvatarStory = {
storyName: "styling",
render: () => (
<Inline>
<Avatar name="Sally Ride" border="warning-7" />
<Avatar name="Sally Ride" border="warning" />
<Avatar name="Sally Ride" className="border-red" />
<Avatar name="Sally Ride" style={{ border: "1px solid red" }} />
</Inline>
Expand Down
Loading
Loading