Skip to content
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
6 changes: 4 additions & 2 deletions code/addons/docs/src/blocks/components/DocsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const toGlobalSelector = (element: string): string =>

const breakpoint = 600;

export const Title = styled.h1(withReset, ({ theme }) => ({
export const Title = styled.h1(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
color: theme.color.defaultText,
fontSize: theme.typography.size.m3,
fontWeight: theme.typography.weight.bold,
Expand All @@ -39,7 +40,8 @@ export const Title = styled.h1(withReset, ({ theme }) => ({
},
}));

export const Subtitle = styled.h2(withReset, ({ theme }) => ({
export const Subtitle = styled.h2(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
fontWeight: theme.typography.weight.regular,
fontSize: theme.typography.size.s3,
lineHeight: '20px',
Expand Down
4 changes: 3 additions & 1 deletion code/addons/docs/src/blocks/components/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { withReset } from 'storybook/internal/components';

import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

const breakpoint = 600;

export const Title = styled.h1(withReset, ({ theme }) => ({
export const Title = styled.h1(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
color: theme.color.defaultText,
fontSize: theme.typography.size.m3,
fontWeight: theme.typography.weight.bold,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withReset } from '../lib/common';
import { Link } from './Link';

export const A = styled(Link)(withReset, ({ theme }) => ({
export const A = styled(Link)(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
fontSize: 'inherit',
lineHeight: '24px',

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

export const Blockquote = styled.blockquote(withReset, withMargin, ({ theme }) => ({
export const Blockquote = styled.blockquote(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
borderLeft: `4px solid ${theme.color.medium}`,
padding: '0 15px',
color: theme.color.dark,
Expand Down
27 changes: 13 additions & 14 deletions code/core/src/components/components/typography/elements/Code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ComponentProps } from 'react';
import React, { Children } from 'react';

import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { SyntaxHighlighter } from '../../syntaxhighlighter/lazy-syntaxhighlighter';
Expand All @@ -10,20 +11,18 @@ import { isReactChildString } from '../lib/isReactChildString';

const isInlineCodeRegex = /[\n\r]/g;

const DefaultCodeBlock = styled.code(
({ theme }) => ({
// from reset
fontFamily: theme.typography.fonts.mono,
WebkitFontSmoothing: 'antialiased',
MozOsxFontSmoothing: 'grayscale',
display: 'inline-block',
paddingLeft: 2,
paddingRight: 2,
verticalAlign: 'baseline',
color: 'inherit',
}),
codeCommon
);
const DefaultCodeBlock = styled.code(({ theme }) => ({
// from reset
fontFamily: theme.typography.fonts.mono,
WebkitFontSmoothing: 'antialiased',
MozOsxFontSmoothing: 'grayscale',
display: 'inline-block',
paddingLeft: 2,
paddingRight: 2,
verticalAlign: 'baseline',
color: 'inherit',
...(codeCommon({ theme }) as CSSObject),
}));

const StyledSyntaxHighlighter = styled(SyntaxHighlighter)(({ theme }) => ({
// DocBlocks-specific styling and overrides
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

export const DL = styled.dl(withReset, withMargin, {
export const DL = styled.dl(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
padding: 0,
'& dt': {
fontSize: '14px',
Expand Down Expand Up @@ -34,4 +37,4 @@ export const DL = styled.dl(withReset, withMargin, {
'& dd > :last-child': {
marginBottom: 0,
},
});
}));
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H1 = styled.h1(withReset, headerCommon, ({ theme }) => ({
export const H1 = styled.h1(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.l1}px`,
fontWeight: theme.typography.weight.bold,
}));
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H2 = styled.h2(withReset, headerCommon, ({ theme }) => ({
export const H2 = styled.h2(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.m2}px`,
paddingBottom: 4,
borderBottom: `1px solid ${theme.appBorderColor}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H3 = styled.h3(withReset, headerCommon, ({ theme }) => ({
export const H3 = styled.h3(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.m1}px`,
}));
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H4 = styled.h4(withReset, headerCommon, ({ theme }) => ({
export const H4 = styled.h4(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.s3}px`,
}));
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H5 = styled.h5(withReset, headerCommon, ({ theme }) => ({
export const H5 = styled.h5(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.s2}px`,
}));
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { headerCommon, withReset } from '../lib/common';

export const H6 = styled.h6(withReset, headerCommon, ({ theme }) => ({
export const H6 = styled.h6(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...(headerCommon({ theme }) as CSSObject),
fontSize: `${theme.typography.size.s2}px`,
color: theme.color.dark,
}));
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { styled } from 'storybook/theming';

import { codeCommon, withReset } from '../lib/common';

export const LI = styled.li(withReset, ({ theme }) => ({
export const LI = styled.li(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
fontSize: theme.typography.size.s2,
color: theme.color.defaultText,
lineHeight: '24px',
Expand Down
11 changes: 7 additions & 4 deletions code/core/src/components/components/typography/elements/OL.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Interpolation } from 'storybook/theming';
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

const listCommon: Interpolation = {
const listCommon = {
paddingLeft: 30,
'& :first-of-type': {
marginTop: 0,
Expand All @@ -13,6 +13,9 @@ const listCommon: Interpolation = {
},
};

export const OL = styled.ol(withReset, withMargin, listCommon, {
export const OL = styled.ol(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
...listCommon,
listStyle: 'decimal',
});
}));
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { styled } from 'storybook/theming';

import { codeCommon, withMargin, withReset } from '../lib/common';

export const P = styled.p(withReset, withMargin, ({ theme }) => ({
export const P = styled.p(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
fontSize: theme.typography.size.s2,
lineHeight: '24px',
color: theme.color.defaultText,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

export const Pre = styled.pre(withReset, withMargin, ({ theme }) => ({
export const Pre = styled.pre(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
// reset
fontFamily: theme.typography.fonts.mono,
WebkitFontSmoothing: 'antialiased',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withReset } from '../lib/common';

export const Span = styled.span(withReset, ({ theme }) => ({
export const Span = styled.span(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
'&.frame': {
display: 'block',
overflow: 'hidden',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

export const Table = styled.table(withReset, withMargin, ({ theme }) => ({
export const Table = styled.table(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
fontSize: theme.typography.size.s2,
lineHeight: '24px',
padding: 0,
Expand Down
11 changes: 8 additions & 3 deletions code/core/src/components/components/typography/elements/UL.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Interpolation } from 'storybook/theming';
import type { CSSObject } from 'storybook/theming';
import { styled } from 'storybook/theming';

import { withMargin, withReset } from '../lib/common';

const listCommon: Interpolation = {
const listCommon = {
paddingLeft: 30,
'& :first-of-type': {
marginTop: 0,
Expand All @@ -13,4 +13,9 @@ const listCommon: Interpolation = {
},
};

export const UL = styled.ul(withReset, withMargin, listCommon, { listStyle: 'disc' });
export const UL = styled.ul(({ theme }) => ({
...(withReset({ theme }) as CSSObject),
...withMargin,
...listCommon,
listStyle: 'disc',
}));
Loading