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

Spacings mode #820

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/atoms/enums/SpacingsMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum SpacingsMode {
COMFORTABLE = 'comfortable',
COMPACT = 'compact',
EXTRA_COMPACT = 'extra-compact',
}
1 change: 1 addition & 0 deletions src/atoms/enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './Errors';
export * from './Environment';
export * from './Theme';
export * from './SpacingsMode';
43 changes: 43 additions & 0 deletions src/atoms/style/spacings.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Typography } from '@equinor/eds-core-react';
import { Meta, StoryFn } from '@storybook/react';

import { RichTextDisplay } from 'src/molecules';

export const Docs: StoryFn = () => (
<div>
<Typography variant="h3">Spacings modes</Typography>
<Typography>
The spacings are defined with comfortable/compact/extra-compact modes. If
you wish to override what the current spacings mode should be you can do
this:
</Typography>
<br />
<RichTextDisplay
value={`<pre><code>import { SpacingsMode, spacings } from "@equinor/amplify-component-lib";

&lt;div data-spacings-mode={SpacingsMode.COMPACT}&gt;
&lt;Typography style={{ margin: spacings.medium }}&gt;
Text
&lt;/Typography&gt;
&lt;/div&gt; </code></pre>`}
/>
<Typography>
This will also affect the spacings of the components using the spacings
tokens, which should include all the components in ACL
</Typography>
</div>
);
const meta: Meta = {
title: 'Atoms/Style/Spacings',
component: Docs,
parameters: {
layout: 'centered',
design: {
type: 'figma',
url: '',
},
},
args: {},
};

export default meta;