♻️(frontend) refacto useCunninghamTheme
Refacto useCunninghamTheme, we don't need a function to have access to the tokens anymore.
This commit is contained in:
@@ -18,7 +18,7 @@ export const Card = ({
|
|||||||
$background="white"
|
$background="white"
|
||||||
$radius="4px"
|
$radius="4px"
|
||||||
$css={css`
|
$css={css`
|
||||||
border: 1px solid ${colorsTokens()['greyscale-200']};
|
border: 1px solid ${colorsTokens['greyscale-200']};
|
||||||
${$css}
|
${$css}
|
||||||
`}
|
`}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ export const DropdownMenu = ({
|
|||||||
label,
|
label,
|
||||||
topMessage,
|
topMessage,
|
||||||
}: PropsWithChildren<DropdownMenuProps>) => {
|
}: PropsWithChildren<DropdownMenuProps>) => {
|
||||||
const theme = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
const spacings = theme.spacingsTokens();
|
|
||||||
const colors = theme.colorsTokens();
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const blockButtonRef = useRef<HTMLDivElement>(null);
|
const blockButtonRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
@@ -120,11 +118,11 @@ export const DropdownMenu = ({
|
|||||||
key={option.label}
|
key={option.label}
|
||||||
$align="center"
|
$align="center"
|
||||||
$justify="space-between"
|
$justify="space-between"
|
||||||
$background={colors['greyscale-000']}
|
$background={colorsTokens['greyscale-000']}
|
||||||
$color={colors['primary-600']}
|
$color={colorsTokens['primary-600']}
|
||||||
$padding={{ vertical: 'xs', horizontal: 'base' }}
|
$padding={{ vertical: 'xs', horizontal: 'base' }}
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$gap={spacings['base']}
|
$gap={spacingsTokens['base']}
|
||||||
$css={css`
|
$css={css`
|
||||||
border: none;
|
border: none;
|
||||||
${index === 0 &&
|
${index === 0 &&
|
||||||
@@ -148,7 +146,11 @@ export const DropdownMenu = ({
|
|||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<Box $direction="row" $align="center" $gap={spacings['base']}>
|
<Box
|
||||||
|
$direction="row"
|
||||||
|
$align="center"
|
||||||
|
$gap={spacingsTokens['base']}
|
||||||
|
>
|
||||||
{option.icon && (
|
{option.icon && (
|
||||||
<Icon
|
<Icon
|
||||||
$size="20px"
|
$size="20px"
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export const QuickSearchInput = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
|
|
||||||
if (children) {
|
if (children) {
|
||||||
return (
|
return (
|
||||||
@@ -44,7 +43,7 @@ export const QuickSearchInput = ({
|
|||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
className="quick-search-input"
|
className="quick-search-input"
|
||||||
$gap={spacing['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
$padding={{ all: 'base' }}
|
$padding={{ all: 'base' }}
|
||||||
>
|
>
|
||||||
{!loading && <Icon iconName="search" $variation="600" />}
|
{!loading && <Icon iconName="search" $variation="600" />}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export const QuickSearchItemContent = ({
|
|||||||
right,
|
right,
|
||||||
}: QuickSearchItemContentProps) => {
|
}: QuickSearchItemContentProps) => {
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
|
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ export const QuickSearchItemContent = ({
|
|||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
$width="100%"
|
$width="100%"
|
||||||
>
|
>
|
||||||
{left}
|
{left}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const HorizontalSeparator = ({
|
|||||||
$background={
|
$background={
|
||||||
variant === SeparatorVariant.DARK
|
variant === SeparatorVariant.DARK
|
||||||
? '#e5e5e533'
|
? '#e5e5e533'
|
||||||
: colorsTokens()['greyscale-100']
|
: colorsTokens['greyscale-100']
|
||||||
}
|
}
|
||||||
className="--docs--horizontal-separator"
|
className="--docs--horizontal-separator"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ export const SeparatedSection = ({
|
|||||||
showSeparator = true,
|
showSeparator = true,
|
||||||
children,
|
children,
|
||||||
}: PropsWithChildren<Props>) => {
|
}: PropsWithChildren<Props>) => {
|
||||||
const theme = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const colors = theme.colorsTokens();
|
|
||||||
const spacings = theme.spacingsTokens();
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
$css={css`
|
$css={css`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: ${spacings['sm']} 0;
|
padding: ${spacingsTokens['sm']} 0;
|
||||||
${showSeparator &&
|
${showSeparator &&
|
||||||
css`
|
css`
|
||||||
border-bottom: 1px solid ${colors?.['greyscale-200']};
|
border-bottom: 1px solid ${colorsTokens['greyscale-200']};
|
||||||
`}
|
`}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe('<useCunninghamTheme />', () => {
|
|||||||
it('has the logo correctly set', () => {
|
it('has the logo correctly set', () => {
|
||||||
const { themeTokens, setTheme } = useCunninghamTheme.getState();
|
const { themeTokens, setTheme } = useCunninghamTheme.getState();
|
||||||
setTheme('default');
|
setTheme('default');
|
||||||
const logo = themeTokens().logo;
|
const logo = themeTokens.logo;
|
||||||
expect(logo?.src).toBe('/assets/logo-gouv.svg');
|
expect(logo?.src).toBe('/assets/logo-gouv.svg');
|
||||||
expect(logo?.widthHeader).toBe('110px');
|
expect(logo?.widthHeader).toBe('110px');
|
||||||
expect(logo?.widthFooter).toBe('220px');
|
expect(logo?.widthFooter).toBe('220px');
|
||||||
|
|||||||
@@ -3,39 +3,53 @@ import { create } from 'zustand';
|
|||||||
|
|
||||||
import { tokens } from './cunningham-tokens';
|
import { tokens } from './cunningham-tokens';
|
||||||
|
|
||||||
type Tokens = typeof tokens.themes.default;
|
type Tokens = typeof tokens.themes.default &
|
||||||
|
Partial<(typeof tokens.themes)[keyof typeof tokens.themes]>;
|
||||||
type ColorsTokens = Tokens['theme']['colors'];
|
type ColorsTokens = Tokens['theme']['colors'];
|
||||||
type FontSizesTokens = Tokens['theme']['font']['sizes'];
|
type FontSizesTokens = Tokens['theme']['font']['sizes'];
|
||||||
type SpacingsTokens = Tokens['theme']['spacings'];
|
type SpacingsTokens = Tokens['theme']['spacings'];
|
||||||
type ComponentTokens = Tokens['components'];
|
type ComponentTokens = Tokens['components'];
|
||||||
export type Theme = keyof typeof tokens.themes;
|
export type Theme = keyof typeof tokens.themes;
|
||||||
|
|
||||||
interface AuthStore {
|
interface ThemeStore {
|
||||||
theme: string;
|
theme: Theme;
|
||||||
setTheme: (theme: Theme) => void;
|
setTheme: (theme: Theme) => void;
|
||||||
themeTokens: () => Partial<Tokens['theme']>;
|
themeTokens: Partial<Tokens['theme']>;
|
||||||
colorsTokens: () => Partial<ColorsTokens>;
|
colorsTokens: Partial<ColorsTokens>;
|
||||||
fontSizesTokens: () => Partial<FontSizesTokens>;
|
fontSizesTokens: Partial<FontSizesTokens>;
|
||||||
spacingsTokens: () => Partial<SpacingsTokens>;
|
spacingsTokens: Partial<SpacingsTokens>;
|
||||||
componentTokens: () => ComponentTokens;
|
componentTokens: ComponentTokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useCunninghamTheme = create<AuthStore>((set, get) => {
|
const getMergedTokens = (theme: Theme) => {
|
||||||
const currentTheme = () =>
|
return merge({}, tokens.themes['default'], tokens.themes[theme]);
|
||||||
merge(
|
};
|
||||||
tokens.themes['default'],
|
|
||||||
tokens.themes[get().theme as keyof typeof tokens.themes],
|
|
||||||
) as Tokens;
|
|
||||||
|
|
||||||
return {
|
const DEFAULT_THEME: Theme = 'default';
|
||||||
theme: 'default',
|
const defaultTokens = getMergedTokens(DEFAULT_THEME);
|
||||||
themeTokens: () => currentTheme().theme,
|
|
||||||
colorsTokens: () => currentTheme().theme.colors,
|
const initialState: ThemeStore = {
|
||||||
componentTokens: () => currentTheme().components,
|
theme: DEFAULT_THEME,
|
||||||
spacingsTokens: () => currentTheme().theme.spacings,
|
setTheme: () => {},
|
||||||
fontSizesTokens: () => currentTheme().theme.font.sizes,
|
themeTokens: defaultTokens.theme,
|
||||||
setTheme: (theme: Theme) => {
|
colorsTokens: defaultTokens.theme.colors,
|
||||||
set({ theme });
|
componentTokens: defaultTokens.components,
|
||||||
},
|
spacingsTokens: defaultTokens.theme.spacings,
|
||||||
};
|
fontSizesTokens: defaultTokens.theme.font.sizes,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
export const useCunninghamTheme = create<ThemeStore>((set) => ({
|
||||||
|
...initialState,
|
||||||
|
setTheme: (theme: Theme) => {
|
||||||
|
const newTokens = getMergedTokens(theme);
|
||||||
|
|
||||||
|
set({
|
||||||
|
theme,
|
||||||
|
themeTokens: newTokens.theme,
|
||||||
|
colorsTokens: newTokens.theme.colors,
|
||||||
|
componentTokens: newTokens.components,
|
||||||
|
spacingsTokens: newTokens.theme.spacings,
|
||||||
|
fontSizesTokens: newTokens.theme.font.sizes,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export const DocEditor = ({ doc, versionId }: DocEditorProps) => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
$background={colorsTokens()['primary-bg']}
|
$background={colorsTokens['primary-bg']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$css="overflow-x: clip; flex: 1;"
|
$css="overflow-x: clip; flex: 1;"
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ export const DividerBlock = createReactBlockSpec(
|
|||||||
<Box
|
<Box
|
||||||
as="hr"
|
as="hr"
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$background={colorsTokens()['greyscale-300']}
|
$background={colorsTokens['greyscale-300']}
|
||||||
$margin="1rem 0"
|
$margin="1rem 0"
|
||||||
$css={`border: 1px solid ${colorsTokens()['greyscale-300']};`}
|
$css={`border: 1px solid ${colorsTokens['greyscale-300']};`}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const QuoteBlock = createReactBlockSpec(
|
|||||||
$margin="0 0 1rem 0"
|
$margin="0 0 1rem 0"
|
||||||
$padding="0.5rem 1rem"
|
$padding="0.5rem 1rem"
|
||||||
style={{
|
style={{
|
||||||
borderLeft: `4px solid ${colorsTokens()['greyscale-300']}`,
|
borderLeft: `4px solid ${colorsTokens['greyscale-300']}`,
|
||||||
fontStyle: 'italic',
|
fontStyle: 'italic',
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const blockMappingDividerDocx: DocsExporterDocx['mappings']['blockMapping
|
|||||||
},
|
},
|
||||||
border: {
|
border: {
|
||||||
top: {
|
top: {
|
||||||
color: colorsTokens()['greyscale-300'],
|
color: colorsTokens['greyscale-300'],
|
||||||
size: 1,
|
size: 1,
|
||||||
style: 'single',
|
style: 'single',
|
||||||
space: 1,
|
space: 1,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const blockMappingDividerPDF: DocsExporterPDF['mappings']['blockMapping']
|
|||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
marginVertical: 10,
|
marginVertical: 10,
|
||||||
backgroundColor: colorsTokens()['greyscale-300'],
|
backgroundColor: colorsTokens['greyscale-300'],
|
||||||
height: '2px',
|
height: '2px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ interface DocHeaderProps {
|
|||||||
export const DocHeader = ({ doc }: DocHeaderProps) => {
|
export const DocHeader = ({ doc }: DocHeaderProps) => {
|
||||||
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const docIsPublic = doc.link_reach === LinkReach.PUBLIC;
|
const docIsPublic = doc.link_reach === LinkReach.PUBLIC;
|
||||||
@@ -36,21 +34,21 @@ export const DocHeader = ({ doc }: DocHeaderProps) => {
|
|||||||
<Box
|
<Box
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$padding={{ top: isDesktop ? '4xl' : 'md' }}
|
$padding={{ top: isDesktop ? '4xl' : 'md' }}
|
||||||
$gap={spacings['base']}
|
$gap={spacingsTokens['base']}
|
||||||
aria-label={t('It is the card information about the document.')}
|
aria-label={t('It is the card information about the document.')}
|
||||||
className="--docs--doc-header"
|
className="--docs--doc-header"
|
||||||
>
|
>
|
||||||
{(docIsPublic || docIsAuth) && (
|
{(docIsPublic || docIsAuth) && (
|
||||||
<Box
|
<Box
|
||||||
aria-label={t('Public document')}
|
aria-label={t('Public document')}
|
||||||
$color={colors['primary-800']}
|
$color={colorsTokens['primary-800']}
|
||||||
$background={colors['primary-050']}
|
$background={colorsTokens['primary-050']}
|
||||||
$radius={spacings['3xs']}
|
$radius={spacingsTokens['3xs']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$padding="xs"
|
$padding="xs"
|
||||||
$flex={1}
|
$flex={1}
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$css={css`
|
$css={css`
|
||||||
border: 1px solid var(--c--theme--colors--primary-300, #e3e3fd);
|
border: 1px solid var(--c--theme--colors--primary-300, #e3e3fd);
|
||||||
`}
|
`}
|
||||||
@@ -82,7 +80,7 @@ export const DocHeader = ({ doc }: DocHeaderProps) => {
|
|||||||
$align="center"
|
$align="center"
|
||||||
$maxWidth="100%"
|
$maxWidth="100%"
|
||||||
>
|
>
|
||||||
<Box $gap={spacings['3xs']} $overflow="auto">
|
<Box $gap={spacingsTokens['3xs']} $overflow="auto">
|
||||||
<DocTitle doc={doc} />
|
<DocTitle doc={doc} />
|
||||||
|
|
||||||
<Box $direction="row">
|
<Box $direction="row">
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
|
|||||||
onBlurCapture={(event) =>
|
onBlurCapture={(event) =>
|
||||||
handleTitleSubmit(event.target.textContent || '')
|
handleTitleSubmit(event.target.textContent || '')
|
||||||
}
|
}
|
||||||
$color={colorsTokens()['greyscale-1000']}
|
$color={colorsTokens['greyscale-1000']}
|
||||||
$minHeight="40px"
|
$minHeight="40px"
|
||||||
$padding={{ right: 'big' }}
|
$padding={{ right: 'big' }}
|
||||||
$css={css`
|
$css={css`
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
|||||||
|
|
||||||
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
|
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
|
|
||||||
const [isModalRemoveOpen, setIsModalRemoveOpen] = useState(false);
|
const [isModalRemoveOpen, setIsModalRemoveOpen] = useState(false);
|
||||||
const [isModalExportOpen, setIsModalExportOpen] = useState(false);
|
const [isModalExportOpen, setIsModalExportOpen] = useState(false);
|
||||||
const selectHistoryModal = useModal();
|
const selectHistoryModal = useModal();
|
||||||
@@ -182,7 +179,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
|||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$margin={{ left: 'auto' }}
|
$margin={{ left: 'auto' }}
|
||||||
$gap={spacings['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
>
|
>
|
||||||
{!isSmallMobile && (
|
{!isSmallMobile && (
|
||||||
<>
|
<>
|
||||||
@@ -245,12 +242,12 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
|||||||
$css={css`
|
$css={css`
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: ${colors['greyscale-100']};
|
background-color: ${colorsTokens['greyscale-100']};
|
||||||
}
|
}
|
||||||
${isSmallMobile
|
${isSmallMobile
|
||||||
? css`
|
? css`
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid ${colors['greyscale-300']};
|
border: 1px solid ${colorsTokens['greyscale-300']};
|
||||||
`
|
`
|
||||||
: ''}
|
: ''}
|
||||||
`}
|
`}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ interface DocVersionHeaderProps {
|
|||||||
export const DocVersionHeader = ({ title }: DocVersionHeaderProps) => {
|
export const DocVersionHeader = ({ title }: DocVersionHeaderProps) => {
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
|
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -20,7 +19,7 @@ export const DocVersionHeader = ({ title }: DocVersionHeaderProps) => {
|
|||||||
<Box
|
<Box
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$padding={{ vertical: 'base' }}
|
$padding={{ vertical: 'base' }}
|
||||||
$gap={spacings['base']}
|
$gap={spacingsTokens['base']}
|
||||||
aria-label={t('It is the document title')}
|
aria-label={t('It is the document title')}
|
||||||
className="--docs--doc-version-header"
|
className="--docs--doc-version-header"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ export const DocShareAddMemberList = ({
|
|||||||
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
const [invitationRole, setInvitationRole] = useState<Role>(Role.EDITOR);
|
const [invitationRole, setInvitationRole] = useState<Role>(Role.EDITOR);
|
||||||
const canShare = doc.abilities.accesses_manage;
|
const canShare = doc.abilities.accesses_manage;
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const color = colorsTokens();
|
|
||||||
|
|
||||||
const { mutateAsync: createInvitation } = useCreateDocInvitation();
|
const { mutateAsync: createInvitation } = useCreateDocInvitation();
|
||||||
const { mutateAsync: createDocAccess } = useCreateDocAccess();
|
const { mutateAsync: createDocAccess } = useCreateDocAccess();
|
||||||
@@ -115,12 +113,12 @@ export const DocShareAddMemberList = ({
|
|||||||
<Box
|
<Box
|
||||||
data-testid="doc-share-add-member-list"
|
data-testid="doc-share-add-member-list"
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$padding={spacing.sm}
|
$padding={spacingsTokens.sm}
|
||||||
$align="center"
|
$align="center"
|
||||||
$background={color['greyscale-050']}
|
$background={colorsTokens['greyscale-050']}
|
||||||
$radius={spacing['3xs']}
|
$radius={spacingsTokens['3xs']}
|
||||||
$css={css`
|
$css={css`
|
||||||
border: 1px solid ${color['greyscale-200']};
|
border: 1px solid ${colorsTokens['greyscale-200']};
|
||||||
`}
|
`}
|
||||||
className="--docs--doc-share-add-member-list"
|
className="--docs--doc-share-add-member-list"
|
||||||
>
|
>
|
||||||
@@ -129,7 +127,7 @@ export const DocShareAddMemberList = ({
|
|||||||
$align="center"
|
$align="center"
|
||||||
$wrap="wrap"
|
$wrap="wrap"
|
||||||
$flex={1}
|
$flex={1}
|
||||||
$gap={spacing.xs}
|
$gap={spacingsTokens.xs}
|
||||||
>
|
>
|
||||||
{selectedUsers.map((user) => (
|
{selectedUsers.map((user) => (
|
||||||
<DocShareAddMemberListItem
|
<DocShareAddMemberListItem
|
||||||
@@ -139,7 +137,7 @@ export const DocShareAddMemberList = ({
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
<Box $direction="row" $align="center" $gap={spacing.xs}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens.xs}>
|
||||||
<DocRoleDropdown
|
<DocRoleDropdown
|
||||||
canUpdate={canShare}
|
canUpdate={canShare}
|
||||||
currentRole={invitationRole}
|
currentRole={invitationRole}
|
||||||
|
|||||||
@@ -12,27 +12,25 @@ type Props = {
|
|||||||
export const DocShareAddMemberListItem = ({ user, onRemoveUser }: Props) => {
|
export const DocShareAddMemberListItem = ({ user, onRemoveUser }: Props) => {
|
||||||
const { spacingsTokens, colorsTokens, fontSizesTokens } =
|
const { spacingsTokens, colorsTokens, fontSizesTokens } =
|
||||||
useCunninghamTheme();
|
useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const color = colorsTokens();
|
|
||||||
const fontSize = fontSizesTokens();
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
data-testid={`doc-share-add-member-${user.email}`}
|
data-testid={`doc-share-add-member-${user.email}`}
|
||||||
$radius={spacing['3xs']}
|
$radius={spacingsTokens['3xs']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$height="fit-content"
|
$height="fit-content"
|
||||||
$justify="center"
|
$justify="center"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacing['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$background={color['greyscale-250']}
|
$background={colorsTokens['greyscale-250']}
|
||||||
$padding={{
|
$padding={{
|
||||||
left: spacing['xs'],
|
left: spacingsTokens['xs'],
|
||||||
right: spacing['4xs'],
|
right: spacingsTokens['4xs'],
|
||||||
vertical: spacing['4xs'],
|
vertical: spacingsTokens['4xs'],
|
||||||
}}
|
}}
|
||||||
$css={css`
|
$css={css`
|
||||||
color: ${color['greyscale-1000']};
|
color: ${colorsTokens['greyscale-1000']};
|
||||||
font-size: ${fontSize['xs']};
|
font-size: ${fontSizesTokens['xs']};
|
||||||
`}
|
`}
|
||||||
className="--docs--doc-share-add-member-list-item"
|
className="--docs--doc-share-add-member-list-item"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ type Props = {
|
|||||||
export const DocShareInvitationItem = ({ doc, invitation }: Props) => {
|
export const DocShareInvitationItem = ({ doc, invitation }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const fakeUser: User = {
|
const fakeUser: User = {
|
||||||
id: invitation.email,
|
id: invitation.email,
|
||||||
full_name: invitation.email,
|
full_name: invitation.email,
|
||||||
@@ -91,7 +90,7 @@ export const DocShareInvitationItem = ({ doc, invitation }: Props) => {
|
|||||||
alwaysShowRight={true}
|
alwaysShowRight={true}
|
||||||
user={fakeUser}
|
user={fakeUser}
|
||||||
right={
|
right={
|
||||||
<Box $direction="row" $align="center" $gap={spacing['2xs']}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens['2xs']}>
|
||||||
<DocRoleDropdown
|
<DocRoleDropdown
|
||||||
currentRole={invitation.role}
|
currentRole={invitation.role}
|
||||||
onSelectRole={onUpdate}
|
onSelectRole={onUpdate}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export const DocShareMemberItem = ({ doc, access }: Props) => {
|
|||||||
const { toast } = useToastProvider();
|
const { toast } = useToastProvider();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const isNotAllowed =
|
const isNotAllowed =
|
||||||
isOtherOwner || !!isLastOwner || !doc.abilities.accesses_manage;
|
isOtherOwner || !!isLastOwner || !doc.abilities.accesses_manage;
|
||||||
|
|
||||||
@@ -78,7 +77,7 @@ export const DocShareMemberItem = ({ doc, access }: Props) => {
|
|||||||
alwaysShowRight={true}
|
alwaysShowRight={true}
|
||||||
user={access.user}
|
user={access.user}
|
||||||
right={
|
right={
|
||||||
<Box $direction="row" $align="center" $gap={spacing['2xs']}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens['2xs']}>
|
||||||
<DocRoleDropdown
|
<DocRoleDropdown
|
||||||
currentRole={access.role}
|
currentRole={access.role}
|
||||||
onSelectRole={onUpdate}
|
onSelectRole={onUpdate}
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
|
|||||||
const { toast } = useToastProvider();
|
const { toast } = useToastProvider();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
const canManage = doc.abilities.accesses_manage;
|
const canManage = doc.abilities.accesses_manage;
|
||||||
const [linkReach, setLinkReach] = useState<LinkReach>(doc.link_reach);
|
const [linkReach, setLinkReach] = useState<LinkReach>(doc.link_reach);
|
||||||
const [docLinkRole, setDocLinkRole] = useState<LinkRole>(doc.link_role);
|
const [docLinkRole, setDocLinkRole] = useState<LinkRole>(doc.link_role);
|
||||||
@@ -90,7 +88,7 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
|
|||||||
<Box
|
<Box
|
||||||
$padding={{ horizontal: 'base' }}
|
$padding={{ horizontal: 'base' }}
|
||||||
aria-label={t('Doc visibility card')}
|
aria-label={t('Doc visibility card')}
|
||||||
$gap={spacing['base']}
|
$gap={spacingsTokens['base']}
|
||||||
className="--docs--doc-visibility"
|
className="--docs--doc-visibility"
|
||||||
>
|
>
|
||||||
<Text $weight="700" $size="sm" $variation="700">
|
<Text $weight="700" $size="sm" $variation="700">
|
||||||
@@ -100,7 +98,7 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
|
|||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$justify="space-between"
|
$justify="space-between"
|
||||||
$gap={spacing['xs']}
|
$gap={spacingsTokens['xs']}
|
||||||
$width="100%"
|
$width="100%"
|
||||||
$wrap="nowrap"
|
$wrap="nowrap"
|
||||||
>
|
>
|
||||||
@@ -108,18 +106,18 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
|
|||||||
$direction="row"
|
$direction="row"
|
||||||
$align={isDesktop ? 'center' : undefined}
|
$align={isDesktop ? 'center' : undefined}
|
||||||
$padding={{ horizontal: '2xs' }}
|
$padding={{ horizontal: '2xs' }}
|
||||||
$gap={canManage ? spacing['3xs'] : spacing['base']}
|
$gap={canManage ? spacingsTokens['3xs'] : spacingsTokens['base']}
|
||||||
>
|
>
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
label={t('Visibility')}
|
label={t('Visibility')}
|
||||||
arrowCss={css`
|
arrowCss={css`
|
||||||
color: ${colors['primary-800']} !important;
|
color: ${colorsTokens['primary-800']} !important;
|
||||||
`}
|
`}
|
||||||
disabled={!canManage}
|
disabled={!canManage}
|
||||||
showArrow={true}
|
showArrow={true}
|
||||||
options={linkReachOptions}
|
options={linkReachOptions}
|
||||||
>
|
>
|
||||||
<Box $direction="row" $align="center" $gap={spacing['3xs']}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens['3xs']}>
|
||||||
<Icon
|
<Icon
|
||||||
$theme={canManage ? 'primary' : 'greyscale'}
|
$theme={canManage ? 'primary' : 'greyscale'}
|
||||||
$variation={canManage ? '800' : '600'}
|
$variation={canManage ? '800' : '600'}
|
||||||
@@ -142,7 +140,7 @@ export const DocVisibility = ({ doc }: DocVisibilityProps) => {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
{showLinkRoleOptions && (
|
{showLinkRoleOptions && (
|
||||||
<Box $direction="row" $align="center" $gap={spacing['3xs']}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens['3xs']}>
|
||||||
{linkReach !== LinkReach.RESTRICTED && (
|
{linkReach !== LinkReach.RESTRICTED && (
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
disabled={!canManage}
|
disabled={!canManage}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ export const SearchUserRow = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const hasFullName = user.full_name != null && user.full_name !== '';
|
const hasFullName = user.full_name != null && user.full_name !== '';
|
||||||
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QuickSearchItemContent
|
<QuickSearchItemContent
|
||||||
@@ -34,12 +32,14 @@ export const SearchUserRow = ({
|
|||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['xs']}
|
$gap={spacingsTokens['xs']}
|
||||||
className="--docs--search-user-row"
|
className="--docs--search-user-row"
|
||||||
>
|
>
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
user={user}
|
user={user}
|
||||||
background={isInvitation ? colors['greyscale-400'] : undefined}
|
background={
|
||||||
|
isInvitation ? colorsTokens['greyscale-400'] : undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Box $direction="column">
|
<Box $direction="column">
|
||||||
<Text $size="sm" $weight="500" $variation="1000">
|
<Text $size="sm" $weight="500" $variation="1000">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export const Heading = ({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
$radius="4px"
|
$radius="4px"
|
||||||
$background={isActive ? `${colorsTokens()['greyscale-100']}` : 'none'}
|
$background={isActive ? `${colorsTokens['greyscale-100']}` : 'none'}
|
||||||
$css="text-align: left;"
|
$css="text-align: left;"
|
||||||
className="--docs--table-content-heading"
|
className="--docs--table-content-heading"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export const TableContent = () => {
|
|||||||
const { headings } = useHeadingStore();
|
const { headings } = useHeadingStore();
|
||||||
const { editor } = useEditorStore();
|
const { editor } = useEditorStore();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
|
|
||||||
const [headingIdHighlight, setHeadingIdHighlight] = useState<string>();
|
const [headingIdHighlight, setHeadingIdHighlight] = useState<string>();
|
||||||
|
|
||||||
@@ -158,7 +157,7 @@ export const TableContent = () => {
|
|||||||
</BoxButton>
|
</BoxButton>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
$gap={spacing['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$css={css`
|
$css={css`
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
`}
|
`}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export const VersionItem = ({
|
|||||||
isActive,
|
isActive,
|
||||||
}: VersionItemProps) => {
|
}: VersionItemProps) => {
|
||||||
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
|
|
||||||
const [isModalVersionOpen, setIsModalVersionOpen] = useState(false);
|
const [isModalVersionOpen, setIsModalVersionOpen] = useState(false);
|
||||||
|
|
||||||
@@ -33,13 +32,13 @@ export const VersionItem = ({
|
|||||||
<Box
|
<Box
|
||||||
$width="100%"
|
$width="100%"
|
||||||
as="li"
|
as="li"
|
||||||
$background={isActive ? colorsTokens()['greyscale-100'] : 'transparent'}
|
$background={isActive ? colorsTokens['greyscale-100'] : 'transparent'}
|
||||||
$radius={spacing['3xs']}
|
$radius={spacingsTokens['3xs']}
|
||||||
$css={`
|
$css={`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${colorsTokens()['greyscale-100']};
|
background: ${colorsTokens['greyscale-100']};
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
$hasTransition
|
$hasTransition
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const DocsGridItem = ({ doc }: DocsGridItemProps) => {
|
|||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const { flexLeft, flexRight } = useResponsiveDocGrid();
|
const { flexLeft, flexRight } = useResponsiveDocGrid();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const shareModal = useModal();
|
const shareModal = useModal();
|
||||||
const isPublic = doc.link_reach === LinkReach.PUBLIC;
|
const isPublic = doc.link_reach === LinkReach.PUBLIC;
|
||||||
const isAuthenticated = doc.link_reach === LinkReach.AUTHENTICATED;
|
const isAuthenticated = doc.link_reach === LinkReach.AUTHENTICATED;
|
||||||
@@ -63,7 +62,7 @@ export const DocsGridItem = ({ doc }: DocsGridItemProps) => {
|
|||||||
data-testid={`docs-grid-name-${doc.id}`}
|
data-testid={`docs-grid-name-${doc.id}`}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings.xs}
|
$gap={spacingsTokens.xs}
|
||||||
$flex={flexLeft}
|
$flex={flexLeft}
|
||||||
$padding={{ right: isDesktop ? 'md' : '3xs' }}
|
$padding={{ right: isDesktop ? 'md' : '3xs' }}
|
||||||
$maxWidth="100%"
|
$maxWidth="100%"
|
||||||
@@ -119,7 +118,7 @@ export const DocsGridItem = ({ doc }: DocsGridItemProps) => {
|
|||||||
</StyledLink>
|
</StyledLink>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box $direction="row" $align="center" $gap={spacings.lg}>
|
<Box $direction="row" $align="center" $gap={spacingsTokens.lg}>
|
||||||
{isDesktop && (
|
{isDesktop && (
|
||||||
<DocsGridItemSharedButton
|
<DocsGridItemSharedButton
|
||||||
doc={doc}
|
doc={doc}
|
||||||
|
|||||||
@@ -34,13 +34,12 @@ export const SimpleDocItem = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const { untitledDocument } = useTrans();
|
const { untitledDocument } = useTrans();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$gap={spacings.sm}
|
$gap={spacingsTokens.sm}
|
||||||
$overflow="auto"
|
$overflow="auto"
|
||||||
className="--docs--simple-doc-item"
|
className="--docs--simple-doc-item"
|
||||||
>
|
>
|
||||||
@@ -73,7 +72,7 @@ export const SimpleDocItem = ({
|
|||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$margin={{ top: '-2px' }}
|
$margin={{ top: '-2px' }}
|
||||||
>
|
>
|
||||||
<Text $variation="600" $size="xs">
|
<Text $variation="600" $size="xs">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const BlueStripe = styled.div`
|
|||||||
export const Footer = () => {
|
export const Footer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { themeTokens } = useCunninghamTheme();
|
const { themeTokens } = useCunninghamTheme();
|
||||||
const logo = themeTokens().logo;
|
const logo = themeTokens.logo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box $position="relative" as="footer" className="--docs--footer">
|
<Box $position="relative" as="footer" className="--docs--footer">
|
||||||
|
|||||||
@@ -16,12 +16,9 @@ import { Title } from './Title';
|
|||||||
|
|
||||||
export const Header = () => {
|
export const Header = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
|
|
||||||
const spacings = theme.spacingsTokens();
|
|
||||||
const colors = theme.colorsTokens();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
as="header"
|
as="header"
|
||||||
@@ -35,9 +32,9 @@ export const Header = () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
height: ${HEADER_HEIGHT}px;
|
height: ${HEADER_HEIGHT}px;
|
||||||
padding: 0 ${spacings['base']};
|
padding: 0 ${spacingsTokens['base']};
|
||||||
background-color: ${colors['greyscale-000']};
|
background-color: ${colorsTokens['greyscale-000']};
|
||||||
border-bottom: 1px solid ${colors['greyscale-200']};
|
border-bottom: 1px solid ${colorsTokens['greyscale-200']};
|
||||||
`}
|
`}
|
||||||
className="--docs--header"
|
className="--docs--header"
|
||||||
>
|
>
|
||||||
@@ -45,7 +42,7 @@ export const Header = () => {
|
|||||||
<StyledLink href="/">
|
<StyledLink href="/">
|
||||||
<Box
|
<Box
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$position="relative"
|
$position="relative"
|
||||||
$height="fit-content"
|
$height="fit-content"
|
||||||
@@ -56,11 +53,11 @@ export const Header = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
{!isDesktop ? (
|
{!isDesktop ? (
|
||||||
<Box $direction="row" $gap={spacings['sm']}>
|
<Box $direction="row" $gap={spacingsTokens['sm']}>
|
||||||
<LaGaufre />
|
<LaGaufre />
|
||||||
</Box>
|
</Box>
|
||||||
) : (
|
) : (
|
||||||
<Box $align="center" $gap={spacings['sm']} $direction="row">
|
<Box $align="center" $gap={spacingsTokens['sm']} $direction="row">
|
||||||
<ButtonLogin />
|
<ButtonLogin />
|
||||||
<LanguagePicker />
|
<LanguagePicker />
|
||||||
<LaGaufre />
|
<LaGaufre />
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const GaufreStyle = createGlobalStyle`
|
|||||||
export const LaGaufre = () => {
|
export const LaGaufre = () => {
|
||||||
const { componentTokens } = useCunninghamTheme();
|
const { componentTokens } = useCunninghamTheme();
|
||||||
|
|
||||||
if (!componentTokens()['la-gauffre'].activated) {
|
if (!componentTokens['la-gauffre'].activated) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import { useCunninghamTheme } from '@/cunningham';
|
|||||||
|
|
||||||
export const Title = () => {
|
export const Title = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = theme.spacingsTokens();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
className="--docs--title"
|
className="--docs--title"
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
@@ -16,9 +16,8 @@ import { getHeaderHeight } from './HomeHeader';
|
|||||||
export default function HomeBanner() {
|
export default function HomeBanner() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { componentTokens, spacingsTokens } = useCunninghamTheme();
|
const { componentTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const { isMobile, isSmallMobile } = useResponsiveStore();
|
const { isMobile, isSmallMobile } = useResponsiveStore();
|
||||||
const withProConnect = componentTokens()['home-proconnect'].activated;
|
const withProConnect = componentTokens['home-proconnect'].activated;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -45,7 +44,7 @@ export default function HomeBanner() {
|
|||||||
$width={!isMobile ? '50%' : '100%'}
|
$width={!isMobile ? '50%' : '100%'}
|
||||||
$justify="center"
|
$justify="center"
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['sm']}
|
$gap={spacingsTokens['sm']}
|
||||||
>
|
>
|
||||||
<Image src={DocLogo} alt="DocLogo" width={64} />
|
<Image src={DocLogo} alt="DocLogo" width={64} />
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useResponsiveStore } from '@/stores';
|
|||||||
|
|
||||||
export function HomeBottom() {
|
export function HomeBottom() {
|
||||||
const { componentTokens } = useCunninghamTheme();
|
const { componentTokens } = useCunninghamTheme();
|
||||||
const withProConnect = componentTokens()['home-proconnect'].activated;
|
const withProConnect = componentTokens['home-proconnect'].activated;
|
||||||
|
|
||||||
if (!withProConnect) {
|
if (!withProConnect) {
|
||||||
return null;
|
return null;
|
||||||
@@ -22,7 +22,6 @@ export function HomeBottom() {
|
|||||||
function HomeProConnect() {
|
function HomeProConnect() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const { isMobile } = useResponsiveStore();
|
const { isMobile } = useResponsiveStore();
|
||||||
const parentGap = '230px';
|
const parentGap = '230px';
|
||||||
|
|
||||||
@@ -33,14 +32,14 @@ function HomeProConnect() {
|
|||||||
className="--docs--home-proconnect"
|
className="--docs--home-proconnect"
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
$gap={spacings['md']}
|
$gap={spacingsTokens['md']}
|
||||||
$direction="column"
|
$direction="column"
|
||||||
$align="center"
|
$align="center"
|
||||||
$margin={{ top: isMobile ? 'none' : `-${parentGap}` }}
|
$margin={{ top: isMobile ? 'none' : `-${parentGap}` }}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$position="relative"
|
$position="relative"
|
||||||
$height="fit-content"
|
$height="fit-content"
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export function HomeContent() {
|
|||||||
<Box
|
<Box
|
||||||
$css={css`
|
$css={css`
|
||||||
& a {
|
& a {
|
||||||
color: ${colorsTokens()['primary-600']};
|
color: ${colorsTokens['primary-600']};
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ export const getHeaderHeight = (isSmallMobile: boolean) =>
|
|||||||
export const HomeHeader = () => {
|
export const HomeHeader = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { themeTokens, spacingsTokens } = useCunninghamTheme();
|
const { themeTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
const logo = themeTokens.logo;
|
||||||
const logo = themeTokens().logo;
|
|
||||||
const { isSmallMobile } = useResponsiveStore();
|
const { isSmallMobile } = useResponsiveStore();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -57,7 +56,7 @@ export const HomeHeader = () => {
|
|||||||
)}
|
)}
|
||||||
<Box
|
<Box
|
||||||
$align="center"
|
$align="center"
|
||||||
$gap={spacings['3xs']}
|
$gap={spacingsTokens['3xs']}
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$position="relative"
|
$position="relative"
|
||||||
$height="fit-content"
|
$height="fit-content"
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ export const HomeSection = ({
|
|||||||
}: HomeSectionProps) => {
|
}: HomeSectionProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
|
|
||||||
const { isSmallMobile } = useResponsiveStore();
|
const { isSmallMobile } = useResponsiveStore();
|
||||||
|
|
||||||
@@ -97,17 +96,17 @@ export const HomeSection = ({
|
|||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
$direction={direction}
|
$direction={direction}
|
||||||
$gap={!isSmallDevice ? spacings['lg'] : spacings['sm']}
|
$gap={!isSmallDevice ? spacingsTokens['lg'] : spacingsTokens['sm']}
|
||||||
$maxHeight="100%"
|
$maxHeight="100%"
|
||||||
$height="auto"
|
$height="auto"
|
||||||
$width="100%"
|
$width="100%"
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
$gap={spacings['sm']}
|
$gap={spacingsTokens['sm']}
|
||||||
$maxWidth="850px"
|
$maxWidth="850px"
|
||||||
$css={direction === 'column' ? '100%' : `flex-basis: ${textWidth};`}
|
$css={direction === 'column' ? '100%' : `flex-basis: ${textWidth};`}
|
||||||
>
|
>
|
||||||
<Box $direction="row" $gap={spacings['sm']} $wrap="wrap">
|
<Box $direction="row" $gap={spacingsTokens['sm']} $wrap="wrap">
|
||||||
<SectionTag tag={tag} />
|
<SectionTag tag={tag} />
|
||||||
{availableSoon && (
|
{availableSoon && (
|
||||||
<SectionTag tag={t('Available soon')} availableSoon />
|
<SectionTag tag={t('Available soon')} availableSoon />
|
||||||
@@ -200,14 +199,14 @@ const SectionTag = ({
|
|||||||
availableSoon?: boolean;
|
availableSoon?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const spacings = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
$background={
|
$background={
|
||||||
!availableSoon ? colors['primary-100'] : colors['warning-100']
|
!availableSoon
|
||||||
|
? colorsTokens['primary-100']
|
||||||
|
: colorsTokens['warning-100']
|
||||||
}
|
}
|
||||||
$padding={{ horizontal: spacings['sm'], vertical: '6px' }}
|
$padding={{ horizontal: spacingsTokens['sm'], vertical: '6px' }}
|
||||||
$css={css`
|
$css={css`
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ export const LeftPanelTargetFilters = () => {
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { togglePanel } = useLeftPanelStore();
|
const { togglePanel } = useLeftPanelStore();
|
||||||
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
const colors = colorsTokens();
|
|
||||||
|
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const target =
|
const target =
|
||||||
@@ -52,7 +50,7 @@ export const LeftPanelTargetFilters = () => {
|
|||||||
<Box
|
<Box
|
||||||
$justify="center"
|
$justify="center"
|
||||||
$padding={{ horizontal: 'sm' }}
|
$padding={{ horizontal: 'sm' }}
|
||||||
$gap={spacing['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
className="--docs--left-panel-target-filters"
|
className="--docs--left-panel-target-filters"
|
||||||
>
|
>
|
||||||
{defaultQueries.map((query) => {
|
{defaultQueries.map((query) => {
|
||||||
@@ -67,17 +65,17 @@ export const LeftPanelTargetFilters = () => {
|
|||||||
aria-selected={isActive}
|
aria-selected={isActive}
|
||||||
$align="center"
|
$align="center"
|
||||||
$justify="flex-start"
|
$justify="flex-start"
|
||||||
$gap={spacing['xs']}
|
$gap={spacingsTokens['xs']}
|
||||||
$radius={spacing['3xs']}
|
$radius={spacingsTokens['3xs']}
|
||||||
$padding={{ all: '2xs' }}
|
$padding={{ all: '2xs' }}
|
||||||
$css={css`
|
$css={css`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: ${isActive
|
background-color: ${isActive
|
||||||
? colors['greyscale-100']
|
? colorsTokens['greyscale-100']
|
||||||
: undefined};
|
: undefined};
|
||||||
font-weight: ${isActive ? 700 : undefined};
|
font-weight: ${isActive ? 700 : undefined};
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: ${colors['greyscale-100']};
|
background-color: ${colorsTokens['greyscale-100']};
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ const MobileLeftPanelStyle = createGlobalStyle`
|
|||||||
export const LeftPanel = () => {
|
export const LeftPanel = () => {
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
|
|
||||||
const theme = useCunninghamTheme();
|
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
|
||||||
const { togglePanel, isPanelOpen } = useLeftPanelStore();
|
const { togglePanel, isPanelOpen } = useLeftPanelStore();
|
||||||
|
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const colors = theme.colorsTokens();
|
|
||||||
const spacings = theme.spacingsTokens();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
togglePanel(false);
|
togglePanel(false);
|
||||||
@@ -44,7 +42,7 @@ export const LeftPanel = () => {
|
|||||||
width: 300px;
|
width: 300px;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-right: 1px solid ${colors['greyscale-200']};
|
border-right: 1px solid ${colorsTokens['greyscale-200']};
|
||||||
`}
|
`}
|
||||||
className="--docs--left-panel-desktop"
|
className="--docs--left-panel-desktop"
|
||||||
>
|
>
|
||||||
@@ -81,13 +79,17 @@ export const LeftPanel = () => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: ${spacings['base']};
|
gap: ${spacingsTokens['base']};
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<LeftPanelHeader />
|
<LeftPanelHeader />
|
||||||
<LeftPanelContent />
|
<LeftPanelContent />
|
||||||
<SeparatedSection showSeparator={false}>
|
<SeparatedSection showSeparator={false}>
|
||||||
<Box $justify="center" $align="center" $gap={spacings['sm']}>
|
<Box
|
||||||
|
$justify="center"
|
||||||
|
$align="center"
|
||||||
|
$gap={spacingsTokens['sm']}
|
||||||
|
>
|
||||||
<ButtonLogin />
|
<ButtonLogin />
|
||||||
<LanguagePicker />
|
<LanguagePicker />
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { SimpleDocItem } from '@/docs/docs-grid';
|
|||||||
export const LeftPanelDocContent = () => {
|
export const LeftPanelDocContent = () => {
|
||||||
const { currentDoc } = useDocStore();
|
const { currentDoc } = useDocStore();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
if (!currentDoc) {
|
if (!currentDoc) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export const LeftPanelDocContent = () => {
|
|||||||
<Box $padding={{ horizontal: 'sm' }}>
|
<Box $padding={{ horizontal: 'sm' }}>
|
||||||
<Box
|
<Box
|
||||||
$css={css`
|
$css={css`
|
||||||
padding: ${spacing['2xs']};
|
padding: ${spacingsTokens['2xs']};
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: var(--c--theme--colors--greyscale-100);
|
background-color: var(--c--theme--colors--greyscale-100);
|
||||||
`}
|
`}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ export const LeftPanelFavoriteItem = ({ doc }: LeftPanelFavoriteItemProps) => {
|
|||||||
const shareModal = useModal();
|
const shareModal = useModal();
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
$direction="row"
|
$direction="row"
|
||||||
$align="center"
|
$align="center"
|
||||||
$justify="space-between"
|
$justify="space-between"
|
||||||
$css={css`
|
$css={css`
|
||||||
padding: ${spacing['2xs']};
|
padding: ${spacingsTokens['2xs']};
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
.pinned-actions {
|
.pinned-actions {
|
||||||
opacity: ${isDesktop ? 0 : 1};
|
opacity: ${isDesktop ? 0 : 1};
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export const LeftPanelFavorites = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { spacingsTokens } = useCunninghamTheme();
|
const { spacingsTokens } = useCunninghamTheme();
|
||||||
const spacing = spacingsTokens();
|
|
||||||
|
|
||||||
const docs = useInfiniteDocs({
|
const docs = useInfiniteDocs({
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -29,7 +28,7 @@ export const LeftPanelFavorites = () => {
|
|||||||
<Box
|
<Box
|
||||||
$justify="center"
|
$justify="center"
|
||||||
$padding={{ horizontal: 'sm', top: 'sm' }}
|
$padding={{ horizontal: 'sm', top: 'sm' }}
|
||||||
$gap={spacing['2xs']}
|
$gap={spacingsTokens['2xs']}
|
||||||
$height="100%"
|
$height="100%"
|
||||||
data-testid="left-panel-favorites"
|
data-testid="left-panel-favorites"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export function MainLayout({
|
|||||||
}: PropsWithChildren<MainLayoutProps>) {
|
}: PropsWithChildren<MainLayoutProps>) {
|
||||||
const { isDesktop } = useResponsiveStore();
|
const { isDesktop } = useResponsiveStore();
|
||||||
const { colorsTokens } = useCunninghamTheme();
|
const { colorsTokens } = useCunninghamTheme();
|
||||||
const colors = colorsTokens();
|
|
||||||
const currentBackgroundColor = !isDesktop ? 'white' : backgroundColor;
|
const currentBackgroundColor = !isDesktop ? 'white' : backgroundColor;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -43,8 +42,8 @@ export function MainLayout({
|
|||||||
}}
|
}}
|
||||||
$background={
|
$background={
|
||||||
currentBackgroundColor === 'white'
|
currentBackgroundColor === 'white'
|
||||||
? colors['greyscale-000']
|
? colorsTokens['greyscale-000']
|
||||||
: colors['greyscale-050']
|
: colorsTokens['greyscale-050']
|
||||||
}
|
}
|
||||||
$css={css`
|
$css={css`
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const Page: NextPageWithLayout = () => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box
|
||||||
as="h1"
|
as="h1"
|
||||||
$background={colorsTokens()['primary-100']}
|
$background={colorsTokens['primary-100']}
|
||||||
$margin="none"
|
$margin="none"
|
||||||
$padding="large"
|
$padding="large"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const Page: NextPageWithLayout = () => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box
|
||||||
as="h1"
|
as="h1"
|
||||||
$background={colorsTokens()['primary-100']}
|
$background={colorsTokens['primary-100']}
|
||||||
$margin="none"
|
$margin="none"
|
||||||
$padding="large"
|
$padding="large"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const Page: NextPageWithLayout = () => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box
|
||||||
as="h1"
|
as="h1"
|
||||||
$background={colorsTokens()['primary-100']}
|
$background={colorsTokens['primary-100']}
|
||||||
$margin="none"
|
$margin="none"
|
||||||
$padding="large"
|
$padding="large"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user