Skip to content

Commit

Permalink
Remove theming
Browse files Browse the repository at this point in the history
  • Loading branch information
alexasselin008 committed Oct 3, 2023
1 parent fcc6d43 commit 66293a9
Show file tree
Hide file tree
Showing 32 changed files with 1,281 additions and 1,046 deletions.
7 changes: 3 additions & 4 deletions .storybook/decorators/withDocsContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { DocsContainer } from "@storybook/addon-docs";
import { ShareGateTheme, ThemeProvider } from "@components/styling";
import { ThemeProvider } from "@components/styling";

function ThemedDocsContainer({ context, children }) {
const theme = context.globals.theme === "sharegate" ? ShareGateTheme : ShareGateTheme;

return (
<ThemeProvider theme={theme} colorScheme="light">
<ThemeProvider colorScheme="light">
{children}
</ThemeProvider>
);
Expand All @@ -19,4 +18,4 @@ export function withDocsContainer(context, children) {
</ThemedDocsContainer>
</DocsContainer>
);
}
}
3 changes: 1 addition & 2 deletions .storybook/decorators/withThemeProvider.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShareGateTheme, ThemeProvider } from "@components/styling";
import { ThemeProvider } from "@components/styling";

import { isChromatic } from "../env";
import { getGlobals } from "../utils";
Expand All @@ -9,7 +9,6 @@ export function withThemeProvider(story, context) {

return (
<ThemeProvider
theme={ShareGateTheme}
colorScheme={globals.colorScheme}
// min-height ensure popup components renders correctly in chromatic tests.
height={viewMode === "story" || isChromatic ? "600px" : undefined}
Expand Down
3 changes: 0 additions & 3 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import "@css/normalize.css";
import "@components/index.css";
import "./styles";

import { ShareGateTheme, createThemeVars } from "@components/styling";
import { isChromatic, isDocs } from "./env";
import { withBackgroundMatchingColorScheme, withCenteredCanvas, withDocsContainer, withThemeProvider } from "./decorators";

import { Code, Highlight } from "@stories/mdx";
import { Themes } from "./styles/themes";

createThemeVars([ShareGateTheme]);

if (!isChromatic) {
// Custom font makes chromatic inconsistent and cause "false positive". View https://www.chromatic.com/docs/resource-loading#loading-custom-fonts.
import("@css/font/index.css");
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 @@ -14,7 +14,7 @@ render(() => {
const { colorScheme: parentColorScheme } = useColorSchemeContext();

return (
<ThemeProvider theme={ShareGateTheme} colorScheme={parentColorScheme}>
<ThemeProvider colorScheme={parentColorScheme}>
<Div backgroundColor="alias-surface" padding={2}>
<ColorSchemeToggle />
</Div>
Expand Down
4 changes: 2 additions & 2 deletions docs/features/color-schemes/ColorSchemes.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ Orbiter supports by default a *light* and a *dark* color scheme for all componen
A color scheme can either be enforced by providing a specific `light` or `dark` value to a [theme provider](?path=/story/theme-provider--default-story):

```jsx
<ThemeProvider theme={ShareGateTheme} colorScheme="dark">
<ThemeProvider colorScheme="dark">
<Button variant="secondary">Cutoff</Button>
</ThemeProvider>
```

or be selected according to the [user's operating system setting](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) by providing the `system` value:

```jsx
<ThemeProvider theme={ShareGateTheme} colorScheme="system" defaultColorScheme="light">
<ThemeProvider colorScheme="system" defaultColorScheme="light">
<Button variant="secondary">Cutoff</Button>
</ThemeProvider>
```
Expand Down
45 changes: 0 additions & 45 deletions docs/features/theming/ThemeSpecificationTable.jsx

This file was deleted.

185 changes: 0 additions & 185 deletions docs/features/theming/Theming.stories.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions docs/features/tokens/TokenTable.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShareGateTheme, ThemeProvider } from "@components/styling";
import { ThemeProvider } from "@components/styling";
import { arrayOf, func, shape, string } from "prop-types";

import { Div, Span } from "@components/html";
Expand Down Expand Up @@ -36,7 +36,7 @@ export function TokenTable({ colors }) {

return (
// eslint-disable-next-line react/destructuring-assignment
<ThemeProvider theme={ShareGateTheme} colorScheme={docsContext.globals.colorScheme}>
<ThemeProvider colorScheme={docsContext.globals.colorScheme}>
<Table
className="token-table"
columns={[
Expand Down
4 changes: 2 additions & 2 deletions docs/features/tokens/Tokens.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TokenTable, textRenderer, fontSizeRenderer, backgroundRenderer, borderRenderer, durationRenderer, easingRenderer, iconRenderer, lineHeightRenderer, boxShadowRenderer, radiiRenderer, sizingRenderer, spacingRenderer, fontWeightRenderer } from "./TokenTable";
import { Meta } from "@storybook/addon-docs";
import { Div } from "@components/html";
import { ShareGateTheme, ThemeProvider } from "@components/styling"
import { ThemeProvider } from "@components/styling"
import { ColorPaletteTable } from "./ColorPaletteTable";
import { Table } from "@stories/components";

Expand Down Expand Up @@ -34,7 +34,7 @@ Or `CSS` variables:

Those tokens are named for their use case, rather than their value. For example `alias-alert` is named to indicate the appropriate background color for an error message background, as opposed to `red-5` which is less specific and could be used in a number of ways depending on the context.

This makes their intended use clear and intentional, and allows us to develop a scalable and consistent visual language while also being the building block of Orbiter's [theming](/docs/theming--page).
This makes their intended use clear and intentional, and allows us to develop a scalable and consistent visual language.

## Values

Expand Down
12 changes: 3 additions & 9 deletions docs/getting-started/Installation.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,23 @@ More about [ESlint configuration](https://eslint.org/docs/latest/use/configure/c

## Configure your application

Below is an example of how to configure an application with a [pre-constructed](?path=/story/theming--page#option-3-retrieve-a-pre-constructed-theme-from-orbiter) ShareGate theme object:
Below is an example of how to configure an application:

```tsx
// index.ts

import { createThemeVars, ShareGateTheme, ThemeProvider } from "@workleap/orbiter-ui";
import { ThemeProvider } from "@workleap/orbiter-ui";
import { createRoot } from "react-dom/client";
import App from "./App";

createThemeVars([ShareGateTheme]);

const root = createRoot(document.getElementById("root")!);
root.render(
<ThemeProvider theme={ShareGateTheme} colorScheme="light">
<ThemeProvider colorScheme="light">
<App />
</ThemeProvider>
);
```

Instead of harcoding the foundation values in Orbiter, we choose to implement a [theming system](?path=/docs/theming--page) allowing applications to supply their core values to Orbiter.

The theming system introduced a concept of theme object. To configure Orbiter, you'll need to build your own theme object or import a [pre-constructed](?path=/story/theming--page#option-3-retrieve-a-pre-constructed-theme-from-orbiter) one from Orbiter. The theme object will be used to render the foundation variables with the `createThemeVars` function and define a [theme provider](?path=/docs/theme-provider--default-story) at the root of your application.

### Start creating components

You're all set! You can start creating your application with Orbiter:
Expand Down
2 changes: 1 addition & 1 deletion packages/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Every Orbiter custom components must share a consistent API and a similar design

All components should:
- Use Orbiter's [tokens](https://wl-orbiter-website.netlify.app//?path=/docs/tokens--page)
- Support Orbiter's [color schemes](https://wl-orbiter-website.netlify.app//?path=/docs/color-schemes--page) and [theming](https://wl-orbiter-website.netlify.app//?path=/docs/theming--page)
- Support Orbiter's [color schemes](https://wl-orbiter-website.netlify.app//?path=/docs/color-schemes--page)
- Implement Orbiter's [style props](https://wl-orbiter-website.netlify.app//?path=/docs/style-props--page)
- Support Orbiter's [responsive styles](https://wl-orbiter-website.netlify.app//?path=/docs/responsive-styles--page)

Expand Down
Loading

0 comments on commit 66293a9

Please sign in to comment.