✨(frontend) enhance UI components and improve styling
- Updated DropdownMenu and ButtonLogin components for better accessibility and visual consistency. - Refactored Header and Title components to utilize new theming and spacing tokens. - Enhanced LanguagePicker styles for improved user experience. - Introduced new utility functions in doc-management for better handling of ProseMirror nodes and Yjs integration. - Cleaned up unused imports and adjusted component styles for overall code maintainability.
This commit is contained in:
committed by
Anthony LC
parent
899047d9a2
commit
6ad1e27acf
@@ -50,6 +50,7 @@ export const DropdownMenu = ({
|
|||||||
<Box $direction="row" $align="center">
|
<Box $direction="row" $align="center">
|
||||||
<div>{children}</div>
|
<div>{children}</div>
|
||||||
<Icon
|
<Icon
|
||||||
|
$variation="600"
|
||||||
$css={
|
$css={
|
||||||
arrowCss ??
|
arrowCss ??
|
||||||
css`
|
css`
|
||||||
@@ -67,7 +68,7 @@ export const DropdownMenu = ({
|
|||||||
<Box $maxWidth="320px">
|
<Box $maxWidth="320px">
|
||||||
{topMessage && (
|
{topMessage && (
|
||||||
<Text
|
<Text
|
||||||
$variation="1000"
|
$variation="700"
|
||||||
$wrap="wrap"
|
$wrap="wrap"
|
||||||
$size="xs"
|
$size="xs"
|
||||||
$weight="bold"
|
$weight="bold"
|
||||||
@@ -123,10 +124,7 @@ export const DropdownMenu = ({
|
|||||||
iconName={option.icon}
|
iconName={option.icon}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Text
|
<Text $variation={isDisabled ? '400' : '1000'}>
|
||||||
$margin={{ top: '-3px' }}
|
|
||||||
$variation={isDisabled ? '400' : '1000'}
|
|
||||||
>
|
|
||||||
{option.label}
|
{option.label}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Button } from '@openfun/cunningham-react';
|
import { Button } from '@openfun/cunningham-react';
|
||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { useAuthStore } from '@/core/auth';
|
import { useAuthStore } from '@/core/auth';
|
||||||
@@ -10,24 +9,14 @@ export const ButtonLogin = () => {
|
|||||||
|
|
||||||
if (!authenticated) {
|
if (!authenticated) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button onClick={login} color="primary-text" aria-label={t('Login')}>
|
||||||
onClick={login}
|
|
||||||
color="primary-text"
|
|
||||||
icon={<span className="material-icons">login</span>}
|
|
||||||
aria-label={t('Login')}
|
|
||||||
>
|
|
||||||
{t('Login')}
|
{t('Login')}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button onClick={logout} color="primary-text" aria-label={t('Logout')}>
|
||||||
onClick={logout}
|
|
||||||
color="primary-text"
|
|
||||||
icon={<span className="material-icons">logout</span>}
|
|
||||||
aria-label={t('Logout')}
|
|
||||||
>
|
|
||||||
{t('Logout')}
|
{t('Logout')}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -50,8 +50,14 @@ export const Header = () => {
|
|||||||
size="medium"
|
size="medium"
|
||||||
onClick={() => togglePanel()}
|
onClick={() => togglePanel()}
|
||||||
aria-label={t('Open the header menu')}
|
aria-label={t('Open the header menu')}
|
||||||
color="primary-text"
|
color="tertiary-text"
|
||||||
icon={<Icon iconName={isPanelOpen ? 'close' : 'menu'} />}
|
icon={
|
||||||
|
<Icon
|
||||||
|
$variation="800"
|
||||||
|
$theme="primary"
|
||||||
|
iconName={isPanelOpen ? 'close' : 'menu'}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<StyledLink href="/">
|
<StyledLink href="/">
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Text } from '@/components/';
|
import { Box, Text } from '@/components/';
|
||||||
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
|
|
||||||
const Title = () => {
|
const Title = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const theme = useCunninghamTheme();
|
||||||
|
const spacings = theme.spacingsTokens();
|
||||||
|
const colors = theme.colorsTokens();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Box $direction="row" $align="center" $gap={spacings['2xs']}>
|
||||||
<Text
|
|
||||||
$padding="2px 3px"
|
|
||||||
$size="8px"
|
|
||||||
$background="#368bd6"
|
|
||||||
$color="white"
|
|
||||||
$position="absolute"
|
|
||||||
$radius="5px"
|
|
||||||
$css={`
|
|
||||||
bottom: 13px;
|
|
||||||
right: -17px;
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
BETA
|
|
||||||
</Text>
|
|
||||||
<Text $margin="none" as="h2" $color="#000091" $zIndex={1} $size="1.30rem">
|
<Text $margin="none" as="h2" $color="#000091" $zIndex={1} $size="1.30rem">
|
||||||
{t('Docs')}
|
{t('Docs')}
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
<Text
|
||||||
|
$padding={{ horizontal: 'xs', vertical: '1px' }}
|
||||||
|
$size="11px"
|
||||||
|
$theme="primary"
|
||||||
|
$variation="500"
|
||||||
|
$weight="bold"
|
||||||
|
$radius="12px"
|
||||||
|
$background={colors['primary-200']}
|
||||||
|
>
|
||||||
|
BETA
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const SelectStyled = styled(Select)<{ $isSmall?: boolean }>`
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
box-shadow: var(--c--theme--colors--primary-100) 0 0 0 2px !important;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -48,10 +48,16 @@ export const LanguagePicker = () => {
|
|||||||
$gap="0.7rem"
|
$gap="0.7rem"
|
||||||
$align="center"
|
$align="center"
|
||||||
>
|
>
|
||||||
<Text $isMaterialIcon $size="1rem" $theme="primary" $variation="600">
|
<Text
|
||||||
|
$isMaterialIcon
|
||||||
|
$size="1rem"
|
||||||
|
$theme="primary"
|
||||||
|
$weight="bold"
|
||||||
|
$variation="800"
|
||||||
|
>
|
||||||
translate
|
translate
|
||||||
</Text>
|
</Text>
|
||||||
<Text $theme="primary" $variation="600">
|
<Text $theme="primary" $weight="500" $variation="800">
|
||||||
{LANGUAGES_ALLOWED[lang]}
|
{LANGUAGES_ALLOWED[lang]}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user