Skip to content

Commit

Permalink
feat(redmine 1246924): changed padding of FoldableColumnLayout, added…
Browse files Browse the repository at this point in the history
… Button example to TestPage (#25)

* feat(redmine 1246924): changed padding of FoldableColumnLayout, added Button example to TestPage
  • Loading branch information
QuentinLeCaignec authored Sep 28, 2023
1 parent bb18455 commit 093e77a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "Smile-SA/react-front-kit" }
{
"repo": "Smile-SA/react-front-kit"
}
],
"commit": false,
"fixed": [["*"]],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/three-shoes-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smile/react-front-kit': patch
---

Modified padding of `FoldableColumnLayout`, Added `Button` that adds new `SidebarMenu` folders as example to `TestPage`
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function FoldableColumnLayout(
/>
</Grid.Col>
</Grid>
<Grid grow gutter="xl">
<Grid grow gutter="xl" pt={12}>
{Boolean(isColumnVisible) && (
<Grid.Col span={3}>{sidebarContent}</Grid.Col>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exports[`FoldableColumnLayout matches snapshot 1`] = `
</div>
</div>
<div
class="mantine-Grid-root mantine-1go31lo"
class="mantine-Grid-root mantine-zodkxp"
>
<div
class="mantine-Grid-col mantine-1slhqex"
Expand Down
27 changes: 25 additions & 2 deletions packages/react-front-kit/src/3-custom/Pages/TestPage/TestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import type { FormEvent, ReactElement } from 'react';

import { Avatar, Menu } from '@mantine/core';
import { Avatar, Button, Flex, Menu } from '@mantine/core';
import { FolderPlus } from '@phosphor-icons/react';
import { useState } from 'react';

import { primaryTheme } from '../../../theme';
import { flattenNestedObjects } from '../../../utils/nested-object';
import { DropdownButton } from '../../Components/DropdownButton/DropdownButton';
import { Header } from '../../Components/Header/Header';
import { SidebarMenu } from '../../Components/SidebarMenu/SidebarMenu';
Expand All @@ -17,11 +19,24 @@ import { FoldableColumnLayout } from '../../Layouts/FoldableColumnLayout/Foldabl
*/
export function TestPage(): ReactElement {
const [search, setSearch] = useState('');
const [sidebarMenu, setSidebarMenu] = useState(menu);

function handleSearchSubmit(event: FormEvent): void {
event.preventDefault();
}

function handleAddFolder(): void {
setSidebarMenu(
sidebarMenu.concat([
{
id: flattenNestedObjects(sidebarMenu).length + 1,
label: 'Nouveau Dossier',
leftIcon: <FolderPlus />,
},
]),
);
}

return (
<FoldableColumnLayout
appShellProps={{
Expand Down Expand Up @@ -60,9 +75,17 @@ export function TestPage(): ReactElement {
),
padding: 0,
}}
sidebarContent={<SidebarMenu menu={menu} />}
sidebarContent={
<Flex direction="column" gap={24}>
<Button onClick={handleAddFolder} size="md">
Nouveau dossier
</Button>
<SidebarMenu menu={sidebarMenu} />
</Flex>
}
sidebarToggleLabel="Voir l'arborescence"
>
<span>Lorem Ipsum dolor sit amet</span>
<p>
Lorem <a href="#">ipsum</a> dolor sit amet, consectetur adipiscing elit.
Sed varius bibendum dui non imperdiet. Donec vehicula fringilla lorem
Expand Down

0 comments on commit 093e77a

Please sign in to comment.