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

♻️(frontend) More multi theme friendly #325

Merged
merged 2 commits into from
Oct 11, 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to

## [Unreleased]

## Changed

♻️(frontend) More multi theme friendly #325


## [1.5.1] - 2024-10-10

## Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/apps/e2e/__tests__/app-impress/header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe('Header', () => {
}),
).toBeVisible();

await expect(header.getByAltText('Language Icon')).toBeVisible();
await expect(header.getByText('English')).toBeVisible();

await expect(
header.getByRole('button', {
Expand Down Expand Up @@ -87,7 +87,7 @@ test.describe('Header mobile', () => {
}),
).toBeHidden();

await expect(page.getByAltText('Language Icon')).toBeHidden();
await expect(page.getByText('English')).toBeHidden();

await header.getByLabel('Open the header menu').click();

Expand All @@ -97,7 +97,7 @@ test.describe('Header mobile', () => {
}),
).toBeVisible();

await expect(page.getByAltText('Language Icon')).toBeVisible();
await expect(page.getByText('English')).toBeVisible();
});
});

Expand Down
8 changes: 8 additions & 0 deletions src/frontend/apps/impress/cunningham.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ const config = {
},
},
},
'la-gauffre': {
activated: false,
},
},
},
dsfr: {
Expand Down Expand Up @@ -321,6 +324,7 @@ const config = {
'color-hover': 'var(--c--theme--colors--primary-100)',
},
'color-hover': 'var(--c--theme--colors--primary-text)',
color: 'var(--c--theme--colors--primary-600)',
},
},
datagrid: {
Expand All @@ -335,6 +339,7 @@ const config = {
pagination: {
'background-color': 'transparent',
'background-color-active': 'var(--c--theme--colors--primary-300)',
'border-color': 'var(--c--theme--colors--primary-400)',
},
},
'forms-checkbox': {
Expand Down Expand Up @@ -384,6 +389,9 @@ const config = {
'forms-textarea': {
'border-radius': '0',
},
'la-gauffre': {
activated: true,
},
},
},
},
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,77 +1,101 @@
@font-face {
font-family: Marianne;
src: url('Marianne-Thin.woff') format('truetype');
src:
url('Marianne-Thin.woff2') format('woff2'),
url('Marianne-Thin.woff') format('woff');
font-weight: 100;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Thin_Italic.woff') format('truetype');
src:
url('Marianne-Thin_Italic.woff2') format('woff2'),
url('Marianne-Thin_Italic.woff') format('woff');
font-weight: 100;
font-style: italic;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Light.woff') format('truetype');
src:
url('Marianne-Light.woff2') format('woff2'),
url('Marianne-Light.woff') format('woff');
font-weight: 300;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Light_Italic.woff') format('truetype');
src:
url('Marianne-Light_Italic.woff2') format('woff2'),
url('Marianne-Light_Italic.woff') format('woff');
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Regular.woff') format('truetype');
src:
url('Marianne-Regular.woff2') format('woff2'),
url('Marianne-Regular.woff') format('woff');
font-weight: 400;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Regular_Italic.woff') format('truetype');
src:
url('Marianne-Regular_Italic.woff2') format('woff2'),
url('Marianne-Regular_Italic.woff') format('woff');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Medium.woff') format('truetype');
src:
url('Marianne-Medium.woff2') format('woff2'),
url('Marianne-Medium.woff') format('woff');
font-weight: 500;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Medium_Italic.woff') format('truetype');
src:
url('Marianne-Medium_Italic.woff2') format('woff2'),
url('Marianne-Medium_Italic.woff') format('woff');
font-weight: 500;
font-style: italic;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Bold.woff') format('truetype');
src:
url('Marianne-Bold.woff2') format('woff2'),
url('Marianne-Bold.woff') format('woff');
font-weight: 700;
}

@font-face {
font-family: Marianne;
src: url('Marianne-Bold_Italic.woff') format('truetype');
src:
url('Marianne-Bold_Italic.woff2') format('woff2'),
url('Marianne-Bold_Italic.woff') format('woff');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: Marianne;
src: url('Marianne-ExtraBold.woff') format('truetype');
src:
url('Marianne-ExtraBold.woff2') format('woff2'),
url('Marianne-ExtraBold.woff') format('woff');
font-weight: 800;
}

@font-face {
font-family: Marianne;
src: url('Marianne-ExtraBold_Italic.woff') format('truetype');
src:
url('Marianne-ExtraBold_Italic.woff2') format('woff2'),
url('Marianne-ExtraBold_Italic.woff') format('woff');
font-weight: 800;
font-style: italic;
}
1 change: 1 addition & 0 deletions src/frontend/apps/impress/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const IconBG = ({ iconName, ...textProps }: IconBGProps) => {
$isMaterialIcon
$size="36px"
$theme="primary"
$variation="600"
$background={colorsTokens()['primary-bg']}
$css={`
border: 1px solid ${colorsTokens()['primary-200']};
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/apps/impress/src/cunningham/cunningham-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ input:-webkit-autofill:focus {
gap: 3px;
border-radius: 4px;
background: var(--c--components--datagrid--pagination--background-color);
border-color: var(--c--components--datagrid--pagination--border-color);
}

.c__pagination__list .c__button--tertiary-text.c__button--active {
Expand Down Expand Up @@ -452,6 +453,7 @@ input:-webkit-autofill:focus {

.c__button--tertiary-text {
border: none;
color: var(--c--components--button--tertiary-text--color);
}

.c__button--tertiary-text:hover,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
);
--c--components--button--disabled--color: white;
--c--components--button--disabled--background--color: #b3cef0;
--c--components--la-gauffre--activated: false;
}

.cunningham-theme--dark {
Expand Down Expand Up @@ -451,6 +452,9 @@
--c--components--button--tertiary-text--color-hover: var(
--c--theme--colors--primary-text
);
--c--components--button--tertiary-text--color: var(
--c--theme--colors--primary-600
);
--c--components--datagrid--header--color: var(
--c--theme--colors--primary-text
);
Expand All @@ -461,6 +465,9 @@
--c--components--datagrid--pagination--background-color-active: var(
--c--theme--colors--primary-300
);
--c--components--datagrid--pagination--border-color: var(
--c--theme--colors--primary-400
);
--c--components--forms-checkbox--border-radius: 0;
--c--components--forms-checkbox--color: var(--c--theme--colors--primary-text);
--c--components--forms-checkbox--text--color: var(
Expand Down Expand Up @@ -504,6 +511,7 @@
--c--theme--colors--primary-text
);
--c--components--forms-textarea--border-radius: 0;
--c--components--la-gauffre--activated: true;
}

.clr-secondary-text {
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/apps/impress/src/cunningham/cunningham-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export const tokens = {
},
disabled: { color: 'white', background: { color: '#b3cef0' } },
},
'la-gauffre': { activated: false },
},
},
dark: {
Expand Down Expand Up @@ -450,6 +451,7 @@ export const tokens = {
'color-hover': 'var(--c--theme--colors--primary-100)',
},
'color-hover': 'var(--c--theme--colors--primary-text)',
color: 'var(--c--theme--colors--primary-600)',
},
},
datagrid: {
Expand All @@ -464,6 +466,7 @@ export const tokens = {
pagination: {
'background-color': 'transparent',
'background-color-active': 'var(--c--theme--colors--primary-300)',
'border-color': 'var(--c--theme--colors--primary-400)',
},
},
'forms-checkbox': {
Expand Down Expand Up @@ -503,6 +506,7 @@ export const tokens = {
'accent-color': 'var(--c--theme--colors--primary-text)',
},
'forms-textarea': { 'border-radius': '0' },
'la-gauffre': { activated: true },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const PanelEditor = ({
$weight="bold"
$size="m"
$theme="primary"
$variation="600"
$padding={{ vertical: 'small', horizontal: 'small' }}
>
{t('Table of content')}
Expand All @@ -118,6 +119,7 @@ export const PanelEditor = ({
$weight="bold"
$size="m"
$theme="primary"
$variation="600"
$padding={{ vertical: 'small', horizontal: 'small' }}
>
{t('Versions')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const DocHeader = ({ doc, versionId }: DocHeaderProps) => {
<Text
$isMaterialIcon
$theme="primary"
$variation="600"
$size="2rem"
$css={`&:hover {background-color: ${colorsTokens()['primary-100']}; };`}
$hasTransition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from '@openfun/cunningham-react';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';

import { Box, DropButton, IconOptions, Text } from '@/components';
import { Box, DropButton, IconOptions } from '@/components';
import { useAuthStore } from '@/core';
import { usePanelEditorStore } from '@/features/docs/doc-editor/';
import {
Expand Down Expand Up @@ -86,7 +86,7 @@ export const DocToolBox = ({ doc, versionId }: DocToolBoxProps) => {
icon={<span className="material-icons">history</span>}
size="small"
>
<Text $theme="primary">{t('Version history')}</Text>
{t('Version history')}
</Button>
)}
<Button
Expand All @@ -99,7 +99,7 @@ export const DocToolBox = ({ doc, versionId }: DocToolBoxProps) => {
icon={<span className="material-icons">summarize</span>}
size="small"
>
<Text $theme="primary">{t('Table of contents')}</Text>
{t('Table of contents')}
</Button>
<Button
onClick={() => {
Expand All @@ -110,7 +110,7 @@ export const DocToolBox = ({ doc, versionId }: DocToolBoxProps) => {
icon={<span className="material-icons">file_download</span>}
size="small"
>
<Text $theme="primary">{t('Export')}</Text>
{t('Export')}
</Button>
{doc.abilities.destroy && (
<Button
Expand All @@ -122,7 +122,7 @@ export const DocToolBox = ({ doc, versionId }: DocToolBoxProps) => {
icon={<span className="material-icons">delete</span>}
size="small"
>
<Text $theme="primary">{t('Delete document')}</Text>
{t('Delete document')}
</Button>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ export const ModalPDF = ({ onClose, doc }: ModalPDFProps) => {
size={ModalSize.MEDIUM}
title={
<Box $align="center" $gap="1rem">
<Text className="material-icons" $size="3.5rem" $theme="primary">
<Text
className="material-icons"
$size="3.5rem"
$theme="primary"
$variation="600"
>
picture_as_pdf
</Text>
<Text as="h2" $size="h3" $margin="none" $theme="primary">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import useCunninghamTheme from '@/cunningham/useCunninghamTheme';

import { useRemoveDoc } from '../api/useRemoveDoc';
import IconDoc from '../assets/icon-doc.svg';
import IconRemove from '../assets/icon-trash.svg';
import { Doc } from '../types';

interface ModalRemoveDocProps {
Expand Down Expand Up @@ -73,7 +72,9 @@ export const ModalRemoveDoc = ({ onClose, doc }: ModalRemoveDocProps) => {
size={ModalSize.MEDIUM}
title={
<Box $align="center" $gap="1rem">
<IconRemove width={48} color={colorsTokens()['primary-text']} />
<Text $isMaterialIcon $size="48px" $theme="primary" $variation="600">
delete_forever
</Text>
<Text as="h2" $size="h3" $margin="none">
{t('Deleting the document "{{title}}"', { title: doc.title })}
</Text>
Expand Down
Loading
Loading