Skip to content

Commit

Permalink
Update Provider mode and density site examples (#3883)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamsms authored Aug 2, 2024
1 parent 4906584 commit 6583d24
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/salt-provider/SaltProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ interface SaltProviderBaseProps {
mode?: Mode;
/**
* Shape of `{ xs: number; sm: number; md: number; lg: number; xl: number; }`.
* Determins breakpoints used in responsive calulation for layout components.
* Determines breakpoints used in responsive calculation for layout components.
*/
breakpoints?: Breakpoints;
/**
Expand Down Expand Up @@ -291,7 +291,7 @@ function InternalSaltProvider({
headingFont: headingFont,
accent: accent,
actionFont: actionFont,
// Backward compatilibty
// Backward compatibility
UNSTABLE_corner: corner,
UNSTABLE_headingFont: headingFont,
UNSTABLE_accent: accent,
Expand Down
2 changes: 1 addition & 1 deletion site/docs/components/salt-provider/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Salt provider
data:
description: "`SaltProvider` is a required component used to change the theme, mode, density and breakpoints of your application."
description: "`SaltProvider` is a required component used to change the theme, mode, density and breakpoints of your application. Refer to the [getting started](/salt/getting-started/developing) page for a full step-by-step implementation guide."

# Fill in the info from the content template's "Metadata" table below.
# To omit optional items, comment them out with #
Expand Down
2 changes: 1 addition & 1 deletion site/docs/getting-started/developing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ If you prefer not to use Google Fonts or Fontsource, you can use any other metho

### 3. Integrate Salt into your app

To integrate Salt into your project, import the CSS theme and Salt Provider component—and then wrap your application in it.
To integrate Salt into your project, import the CSS theme and [Salt Provider](../components/salt-provider) component—and then wrap your application in it.

For example, in a typical React project, you can do this in your `src/index.js` as follows:

Expand Down
29 changes: 19 additions & 10 deletions site/src/examples/salt-provider/Density.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { StackLayout, Text, capitalize, useDensity } from "@salt-ds/core";
import {
FlexLayout,
SaltProvider,
StackLayout,
Text,
capitalize,
useDensity,
} from "@salt-ds/core";
import type { ReactElement } from "react";
import styles from "./Density.module.css";

Expand All @@ -10,14 +17,16 @@ export const Density = (): ReactElement => {
const density = useDensity();

return (
<div>
<Text>{capitalize(density)} Density</Text>
<StackLayout direction="row" className={styles.squares}>
<Square />
<Square />
<Square />
<Square />
</StackLayout>
</div>
<SaltProvider density={density}>
<FlexLayout direction="column">
<Text>{capitalize(density)} Density</Text>
<StackLayout direction="row" className={styles.squares}>
<Square />
<Square />
<Square />
<Square />
</StackLayout>
</FlexLayout>
</SaltProvider>
);
};
8 changes: 6 additions & 2 deletions site/src/examples/salt-provider/Modes.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Card, capitalize, useTheme } from "@salt-ds/core";
import { Card, SaltProvider, capitalize, useTheme } from "@salt-ds/core";
import type { ReactElement } from "react";

export const Modes = (): ReactElement => {
const { mode } = useTheme();

return <Card style={{ minHeight: "unset" }}>{capitalize(mode)} mode</Card>;
return (
<SaltProvider mode={mode}>
<Card style={{ minHeight: "unset" }}>{capitalize(mode)} mode</Card>
</SaltProvider>
);
};

0 comments on commit 6583d24

Please sign in to comment.