Skip to content

Commit

Permalink
💄(app-desk) integrate the create team design
Browse files Browse the repository at this point in the history
- Integrate the create team design based from the
mockup
- Manage the different states of the create team
  • Loading branch information
AntoLC committed Feb 13, 2024
1 parent 9b47515 commit 8c34edf
Show file tree
Hide file tree
Showing 20 changed files with 344 additions and 121 deletions.
38 changes: 28 additions & 10 deletions src/frontend/apps/desk/cunningham.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const config = {
'border-radius': '0',
},
button: {
'border-radius': '2px',
'border-radius': '4px',
primary: {
background: {
color: 'var(--c--theme--colors--primary-text)',
Expand All @@ -269,29 +269,47 @@ const config = {
'color-hover': '#ffffff',
'color-active': '#ffffff',
},
secondary: {
background: {
'color-hover': 'var(--c--theme--colors--primary-100)',
'color-active': 'var(--c--theme--colors--primary-200)',
},
border: {
'color-hover': 'var(--c--theme--colors--primary-300)',
},
color: 'var(--c--theme--colors--primary-text)',
},
},
'forms-checkbox': {
'border-radius': '0',
},
'forms-switch': {
'handle-border-radius': '2px',
'rail-border-radius': '4px',
'forms-datepicker': {
'border-radius': '0',
},
'forms-input': {
'forms-fileuploader': {
'border-radius': '0',
},
'forms-input': {
'border-radius': '4px',
'background-color': '#ffffff',
'border-color': 'var(--c--theme--colors--primary-text)',
'box-shadow-color': 'var(--c--theme--colors--primary-text)',
},
'forms-labelledbox': {
'label-color': {
big: 'var(--c--theme--colors--primary-text)',
},
},
'forms-select': {
'border-radius': '0',
},
'forms-datepicker': {
'border-radius': '0',
'forms-switch': {
'handle-border-radius': '2px',
'rail-border-radius': '4px',
},
'forms-textarea': {
'border-radius': '0',
},
'forms-fileuploader': {
'border-radius': '0',
},
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/apps/desk/src/__tests__/pages.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ describe('Page', () => {
it('checks Page rendering', () => {
render(<Page />, { wrapper: AppWrapper });

expect(screen.getByRole('status')).toBeInTheDocument();

expect(
screen.getByRole('button', {
name: /Create a new team/i,
Expand Down
29 changes: 29 additions & 0 deletions src/frontend/apps/desk/src/assets/icons/icon-group2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/frontend/apps/desk/src/components/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface BoxProps {
$position?: CSSProperties['position'];
$radius?: CSSProperties['borderRadius'];
$width?: CSSProperties['width'];
$maxWidth?: CSSProperties['maxWidth'];
$minWidth?: CSSProperties['minWidth'];
}

export type BoxType = ComponentPropsWithRef<typeof Box>;
Expand All @@ -36,5 +38,7 @@ export const Box = styled('div')<BoxProps>`
${({ $position }) => $position && `position: ${$position};`}
${({ $radius }) => $radius && `border-radius: ${$radius};`}
${({ $width }) => $width && `width: ${$width};`}
${({ $maxWidth }) => $maxWidth && `max-width: ${$maxWidth};`}
${({ $minWidth }) => $minWidth && `min-width: ${$minWidth};`}
${({ $css }) => $css && `${$css};`}
`;
27 changes: 27 additions & 0 deletions src/frontend/apps/desk/src/components/WhiteBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { PropsWithChildren } from 'react';

import { useCunninghamTheme } from '@/cunningham';

import { Box, BoxType } from '.';

export const WhiteBox = ({
children,
$css,
...props
}: PropsWithChildren<BoxType>) => {
const { colorsTokens } = useCunninghamTheme();

return (
<Box
$background="white"
$css={`
box-shadow: 2px 2px 5px ${colorsTokens()['primary-300']}88;
border: 1px solid #e3e3e3;
${$css}
`}
{...props}
>
{children}
</Box>
);
};
1 change: 1 addition & 0 deletions src/frontend/apps/desk/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './Box';
export * from './Text';
export * from './Link';
export * from './WhiteBox';
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,4 @@
--c--components--forms-select--value-color--disabled: var(
--c--theme--colors--greyscale-400
);
--c--components--forms-labelledbox--label-color--big: var(
--c--theme--colors--primary-500
);
}
5 changes: 3 additions & 2 deletions src/frontend/apps/desk/src/cunningham/cunningham-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

.labelled-box label {
color: var(--c--theme--colors--primary-500);
color: var(--c--theme--colors--primary-text);
}

.labelled-box--disabled label {
Expand Down Expand Up @@ -53,7 +53,7 @@

.c__input__wrapper:hover,
.c__textarea__wrapper:hover {
box-shadow: var(--c--theme--colors--primary-500) 0 0 0 2px;
box-shadow: var(--c--components--forms-input--box-shadow-color) 0 0 0 2px;
}

.c__textarea__wrapper--disabled:hover,
Expand Down Expand Up @@ -325,6 +325,7 @@ input:-webkit-autofill:focus {
--c--components--button--secondary--background--color-hover
);
color: var(--c--components--button--secondary--color-hover);
border: 1px solid var(--c--components--button--secondary--border--color-hover);
}

.c__button--tertiary {
Expand Down
32 changes: 27 additions & 5 deletions src/frontend/apps/desk/src/cunningham/cunningham-tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
--c--theme--font--families--accent: marianne;
--c--theme--font--families--base: marianne;
--c--components--alert--border-radius: 0;
--c--components--button--border-radius: 2px;
--c--components--button--border-radius: 4px;
--c--components--button--primary--background--color: var(
--c--theme--colors--primary-text
);
Expand All @@ -399,14 +399,36 @@
--c--components--button--primary--color: #fff;
--c--components--button--primary--color-hover: #fff;
--c--components--button--primary--color-active: #fff;
--c--components--button--secondary--background--color-hover: var(
--c--theme--colors--primary-100
);
--c--components--button--secondary--background--color-active: var(
--c--theme--colors--primary-200
);
--c--components--button--secondary--border--color-hover: var(
--c--theme--colors--primary-300
);
--c--components--button--secondary--color: var(
--c--theme--colors--primary-text
);
--c--components--forms-checkbox--border-radius: 0;
--c--components--forms-datepicker--border-radius: 0;
--c--components--forms-fileuploader--border-radius: 0;
--c--components--forms-input--border-radius: 4px;
--c--components--forms-input--background-color: #fff;
--c--components--forms-input--border-color: var(
--c--theme--colors--primary-text
);
--c--components--forms-input--box-shadow-color: var(
--c--theme--colors--primary-text
);
--c--components--forms-labelledbox--label-color--big: var(
--c--theme--colors--primary-text
);
--c--components--forms-select--border-radius: 0;
--c--components--forms-switch--handle-border-radius: 2px;
--c--components--forms-switch--rail-border-radius: 4px;
--c--components--forms-input--border-radius: 0;
--c--components--forms-select--border-radius: 0;
--c--components--forms-datepicker--border-radius: 0;
--c--components--forms-textarea--border-radius: 0;
--c--components--forms-fileuploader--border-radius: 0;
}

.clr-secondary-text {
Expand Down
26 changes: 21 additions & 5 deletions src/frontend/apps/desk/src/cunningham/cunningham-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export const tokens = {
components: {
alert: { 'border-radius': '0' },
button: {
'border-radius': '2px',
'border-radius': '4px',
primary: {
background: {
color: 'var(--c--theme--colors--primary-text)',
Expand All @@ -408,17 +408,33 @@ export const tokens = {
'color-hover': '#ffffff',
'color-active': '#ffffff',
},
secondary: {
background: {
'color-hover': 'var(--c--theme--colors--primary-100)',
'color-active': 'var(--c--theme--colors--primary-200)',
},
border: { 'color-hover': 'var(--c--theme--colors--primary-300)' },
color: 'var(--c--theme--colors--primary-text)',
},
},
'forms-checkbox': { 'border-radius': '0' },
'forms-datepicker': { 'border-radius': '0' },
'forms-fileuploader': { 'border-radius': '0' },
'forms-input': {
'border-radius': '4px',
'background-color': '#ffffff',
'border-color': 'var(--c--theme--colors--primary-text)',
'box-shadow-color': 'var(--c--theme--colors--primary-text)',
},
'forms-labelledbox': {
'label-color': { big: 'var(--c--theme--colors--primary-text)' },
},
'forms-select': { 'border-radius': '0' },
'forms-switch': {
'handle-border-radius': '2px',
'rail-border-radius': '4px',
},
'forms-input': { 'border-radius': '0' },
'forms-select': { 'border-radius': '0' },
'forms-datepicker': { 'border-radius': '0' },
'forms-textarea': { 'border-radius': '0' },
'forms-fileuploader': { 'border-radius': '0' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ describe('PanelTeams', () => {
).toBeInTheDocument();
});

it('renders with empty team to display', async () => {
it('renders a team empty', async () => {
fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [
{
id: '1',
name: 'Team 1',
accesses: [],
accesses: [
{
id: '1',
role: 'admin',
},
],
},
],
});
Expand All @@ -51,7 +56,7 @@ describe('PanelTeams', () => {
).toBeInTheDocument();
});

it('renders with not team to display', async () => {
it('renders a team not empty', async () => {
fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [
Expand All @@ -63,6 +68,10 @@ describe('PanelTeams', () => {
id: '1',
role: 'admin',
},
{
id: '2',
role: 'member',
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export const Panel = () => {

return (
<Box
$width="28rem"
$width="100%"
$maxWidth="20rem"
$minWidth="14rem"
$css={`
border-right: 1px solid ${colorsTokens()['primary-300']};
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,28 @@ export const PanelTeam = ({ team }: TeamProps) => {

return (
<Box as="li" $direction="row" $align="center" $gap="0.5rem">
{team.accesses.length ? (
{team.accesses.length > 1 ? (
<IconGroup
className="p-t"
width={36}
width={52}
aria-label={t(`Teams icon`)}
color={colorsTokens()['primary-500']}
style={{
borderRadius: '10px',
border: `1px solid ${colorsTokens()['primary-300']}`,
flexShrink: 0,
}}
/>
) : (
<IconNone
className="p-t"
width={36}
width={52}
aria-label={t(`Empty teams icon`)}
color={colorsTokens()['greyscale-500']}
style={{
borderRadius: '10px',
border: `1px solid ${colorsTokens()['greyscale-300']}`,
flexShrink: 0,
}}
/>
)}
Expand Down
10 changes: 9 additions & 1 deletion src/frontend/apps/desk/src/i18n/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
"Create your first team by clicking on the \"Create a new team\" button": "Créez votre premier groupe en cliquant sur le bouton \"Créer un nouveau groupe\".",
"Something bad happens, please refresh the page": "Une erreur inattendue s'est produite, rechargez la page.",
"People": "People",
"People Description": "Description de People"
"People Description": "Description de People",
"Something bad happens, please retry": "Une erreur inattendue s'est produite, rechargez la page.",
"Panel create new team": "Panneau de création d'un nouveau groupe",
"icon group": "icône groupe",
"Name the team": "Nommer le groupe",
"Team name": "Nom du groupe",
"Cancel": "Annuler",
"Create the team": "Créer le groupe",
"Create a new team": "Créer un nouveau groupe"
}
}
}
4 changes: 4 additions & 0 deletions src/frontend/apps/desk/src/pages/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ body {
padding: 0;
}

* {
box-sizing: border-box;
}

::-webkit-scrollbar {
width: 20px;
}
Expand Down
Loading

0 comments on commit 8c34edf

Please sign in to comment.