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

docs: better Dark mode explanation #401

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
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
19 changes: 12 additions & 7 deletions packages/documentation/src/Styles/DarkMode.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ const CommonTemplate = () => {
return (
<>
<p>
Most components support a <code>system</code> mode which allows them to
toggle from dark to light colors automatically by relying on the
Most components support a <code>system</code> mode prop which allows
them to toggle from dark to light colors automatically by relying on the
<code>prefers-color-scheme</code> CSS media feature. For special cases,
there is a<code>alt-system</code> mode which is a toggled version of the
<code>system</code> mode.
</p>
<p>
Additionally, some components also provide a <code>focusMode</code> prop
that is also set to <code>system</code> by default.
</p>

<h2 className="mt-2">Toggling dark mode manually</h2>
<p>
Expand All @@ -82,7 +86,9 @@ module.exports = {
<h2>Kitchen Sink</h2>
<p>
All the components rendered below have their <code>mode</code> sets to{" "}
<code>system</code>.
<code>system</code> by default, except for a few ones where we force the
mode to be different so that the contrast with the background is
accessible (see the Button in the TextInput for example).
</p>

<div className="mb-2 flex flex-wrap gap-2">
Expand Down Expand Up @@ -118,15 +124,15 @@ module.exports = {
label="Type your question here"
helperText="Powered by the sun"
rightElement={
<Button mode="light" focusMode="light" noBorder>
<Button mode="light" noBorder>
Send
</Button>
}
/>
</div>
</form>
<div className="my-2 flex flex-wrap">
<Table caption="Dune" mode="system">
<Table caption="Dune">
<TableHead className="uppercase">
<TableRow>
<TableCell scope="col">Date</TableCell>
Expand Down Expand Up @@ -184,7 +190,6 @@ module.exports = {
<div className="grid">
<Footer
noMargins
mode="system"
row1={<div>App Name v1.0.0</div>}
row2={<div>something something</div>}
/>
Expand All @@ -194,7 +199,7 @@ module.exports = {
};

export const Automatic: Story<any> = () => (
<Card mode="system">
<Card>
<h1>Automatic Dark Mode</h1>
<CommonTemplate />
</Card>
Expand Down
Loading