Skip to content

Commit

Permalink
Merge pull request #166 from BouyguesTelecom/add/examples
Browse files Browse the repository at this point in the history
Add component examples
  • Loading branch information
JulienMora authored Oct 29, 2024
2 parents 3ff7259 + 29437b6 commit 1880d66
Show file tree
Hide file tree
Showing 107 changed files with 1,607 additions and 131 deletions.
79 changes: 79 additions & 0 deletions docs/templates/assets/index-ada2ffa1.js

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions docs/templates/assets/index-c66d9cff.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/templates/assets/trilogy-142b1c5a.css

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions packages/react/components/accordion/Accordion.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react'
import { Accordion, AccordionBody, AccordionHeader, AccordionItem } from './index'

const AccordionExample: React.ReactNode = <Accordion>
<AccordionItem
active
id='1'
>
<AccordionHeader>
Hello World
</AccordionHeader>
<AccordionBody>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. Aenean ac eleifend lacus, in mollis lectus. Donec sodales, arcu et sollicitudin porttitor, tortor urna tempor ligula, id porttitor mi magna a neque. Donec dui urna, vehicula et sem eget, facilisis sodales sem., consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. Aenean ac eleifend lacus, in mollis lectus. Donec sodales, arcu et sollicitudin porttitor, tortor urna tempor ligula, id porttitor mi magna a neque. Donec dui urna, vehicula et sem eget, facilisis sodales sem.
</AccordionBody>
</AccordionItem>
<AccordionItem id='DEUX'>
<AccordionHeader>
Hello World{' '}
</AccordionHeader>
<AccordionBody>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. Aenean ac eleifend lacus, in mollis lectus. Donec sodales, arcu et sollicitudin porttitor, tortor urna tempor ligula, id porttitor mi magna a neque. Donec dui urna, vehicula et sem eget, facilisis sodales sem.
</AccordionBody>
</AccordionItem>
<AccordionItem id='TROIS'>
<AccordionHeader>
Hello World
</AccordionHeader>
<AccordionBody>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. Aenean ac eleifend lacus, in mollis lectus. Donec sodales, arcu et sollicitudin porttitor, tortor urna tempor ligula, id porttitor mi magna a neque. Donec dui urna, vehicula et sem eget, facilisis sodales sem.
</AccordionBody>
</AccordionItem>
<AccordionItem
disabled
id='QUATRE'
>
<AccordionHeader>
Item disabled
</AccordionHeader>
<AccordionBody>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. Aenean ac eleifend lacus, in mollis lectus. Donec sodales, arcu et sollicitudin porttitor, tortor urna tempor ligula, id porttitor mi magna a neque. Donec dui urna, vehicula et sem eget, facilisis sodales sem.
</AccordionBody>
</AccordionItem>
</Accordion>

export default AccordionExample
3 changes: 2 additions & 1 deletion packages/react/components/accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import Accordion from './Accordion'
import AccordionItem from './item'
import AccordionHeader from './header'
import AccordionBody from './body'
import AccordionExample from './Accordion.example'

export { Accordion, AccordionItem, AccordionHeader, AccordionBody }
export { Accordion, AccordionItem, AccordionHeader, AccordionBody, AccordionExample }
2 changes: 1 addition & 1 deletion packages/react/components/accordion/item/AccordionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const AccordionItem = ({
...others
}: AccordionItemProps): JSX.Element => {
const ref = useRef<HTMLDetailsElement>(null)
const {styled} = useTrilogyContext()
const { styled } = useTrilogyContext()

const [isActive, setIsActive] = useState<boolean>(active || false)
const [expandedHeight, setExpandedHeight] = useState<string>()
Expand Down
41 changes: 41 additions & 0 deletions packages/react/components/alert/Alert.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'
import { Alert } from './index'
import { Columns, ColumnsItem } from '../columns'

const AlertExample: React.ReactNode =
<Columns multiline>
<ColumnsItem size={6}>
<Alert
status='INFO'
description='Lorem Ipsum is simply dummy text type and scrambled it to make a type specimen book..'
display
title='Alert information'
/>
</ColumnsItem>
<ColumnsItem size={6}>
<Alert
status='ERROR'
description='Lorem Ipsum is simply dummy text type and scrambled it to make a type specimen book..'
display
title='Alert information'
/>
</ColumnsItem>
<ColumnsItem size={6}>
<Alert
status='SUCCESS'
description='Lorem Ipsum is simply dummy text type and scrambled it to make a type specimen book..'
display
title='Alert information'
/>
</ColumnsItem>
<ColumnsItem size={6}>
<Alert
status='WARNING'
description='Lorem Ipsum is simply dummy text type and scrambled it to make a type specimen book..'
display
title='Alert information'
/>
</ColumnsItem>
</Columns>

export default AlertExample
3 changes: 2 additions & 1 deletion packages/react/components/alert/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Alert, { ToasterAlertProvider } from './Alert'
import AlertExample from './Alert.example'
import ToasterContext from './context'

export { Alert, ToasterContext, ToasterAlertProvider }
export { Alert, AlertExample, ToasterContext, ToasterAlertProvider }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { defaultMatching, getLabel } from './Autocomplete.helpers'
import AutoCompleteMenuNative from './menu/AutoCompleteMenu.native'
import { debounce } from './utils'


/**
* AutoComplete Component
* @param placeholder {string} placeholder for input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InputChangeEventWeb,InputChangeEventNative, InputClickEvent, InputProps } from '@/components/input/InputProps'
import { InputChangeEventWeb, InputChangeEventNative, InputClickEvent, InputProps } from '@/components/input/InputProps'
import { FocusEventHandler } from 'react'

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export const DEFAULT_SPACING_MATRIX: SpacingMatrix = [
[INSERT_SPACE_BETWEEN, 'Link', 'default', TWO],
[INSERT_SPACE_BETWEEN, 'Sticker', 'default', TWO],
[INSERT_SPACE_BETWEEN, 'Tag', 'default', TWO],
];
]
10 changes: 10 additions & 0 deletions packages/react/components/badge/Badge.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import {
Badge
} from "./index"

const BadgeExample: React.ReactNode = <Badge
content={5}
/>

export default BadgeExample
2 changes: 1 addition & 1 deletion packages/react/components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Text, TextMarkup } from "@/components/text"
import clsx from "clsx"
import { hashClass } from "@/helpers"
import { useTrilogyContext } from "@/context"
import {is} from "@/services";
import { is } from "@/services"

/**
* Badge Component
Expand Down
3 changes: 2 additions & 1 deletion packages/react/components/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Badge from './Badge'
import BadgeExample from './Badge.example'

export * from './BadgeEnum'

export { Badge }
export { Badge, BadgeExample }
49 changes: 49 additions & 0 deletions packages/react/components/box/Box.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react'
import { Box, BoxContent, BoxFooter } from './index'
import { Title, TitleLevels } from '@/components/title'
import { Text } from '@/components/text'
import { Columns, ColumnsItem } from '../columns'
import { Link } from '../link'
import { TrilogyColor } from '@/objects'

const BoxExample: React.ReactNode = (
<Columns multiline>
<ColumnsItem size={4}>
<Box>
<BoxContent>
<Title level={TitleLevels.ONE}>Box Title</Title>
<Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec iaculis mauris.</Text>
</BoxContent>
</Box>
</ColumnsItem>
<ColumnsItem size={4}>
<Box flat>
<BoxContent>
<Title level={TitleLevels.ONE}>Box Title</Title>
<Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec iaculis mauris.</Text>
</BoxContent>
</Box>
</ColumnsItem>
<ColumnsItem size={4}>
<Box highlighted={TrilogyColor.WARNING}>
<BoxContent>
<Title level={TitleLevels.ONE}>Box Title</Title>
<Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec iaculis mauris.</Text>
</BoxContent>
</Box>
</ColumnsItem>
<ColumnsItem size={12}>
<Box>
<BoxContent>
<Title level={TitleLevels.ONE}>Box Title</Title>
<Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec iaculis mauris.</Text>
</BoxContent>
<BoxFooter>
<Link>Link</Link>
</BoxFooter>
</Box>
</ColumnsItem>
</Columns>
)

export default BoxExample
3 changes: 2 additions & 1 deletion packages/react/components/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import BoxHeader from './header'
import BoxTableContainer from './table-container'
import BoxItem from './item'
import { BoxItemSize } from './item/BoxItemEnum'
import BoxExample from './Box.example'

export * from './BoxProps'

export { Box, BoxItem, BoxItemSize, BoxHeader, BoxContent, BoxFooter, BoxTableContainer }
export { Box, BoxItem, BoxItemSize, BoxHeader, BoxContent, BoxFooter, BoxTableContainer, BoxExample }
20 changes: 20 additions & 0 deletions packages/react/components/breadcrumb/Breadcrumb.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { Breadcrumb, BreadcrumbItem } from './index'

const BreadcrumbExample: React.ReactNode =
<Breadcrumb>
<BreadcrumbItem href='https://google.fr'>
Google
</BreadcrumbItem>
<BreadcrumbItem to='#anchor'>
Parent avec ancre
</BreadcrumbItem>
<BreadcrumbItem>
Parent
</BreadcrumbItem>
<BreadcrumbItem active>
Page en cours
</BreadcrumbItem>
</Breadcrumb>

export default BreadcrumbExample
3 changes: 2 additions & 1 deletion packages/react/components/breadcrumb/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Breadcrumb from './Breadcrumb'
import BreadcrumbItem from './item'
import BreadcrumbExample from './Breadcrumb.example'

export { Breadcrumb, BreadcrumbItem }
export { Breadcrumb, BreadcrumbItem, BreadcrumbExample }
36 changes: 36 additions & 0 deletions packages/react/components/button/Button.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'
import { ButtonList, Button } from './index'

const ButtonExample: React.ReactNode =
<ButtonList>
<Button
variant='CONVERSION'
>
Button
</Button>
<Button
variant='PRIMARY'
>
Button
</Button>
<Button
variant='SECONDARY'
>
Button
</Button>
<Button
disabled
variant='PRIMARY'
>
Button
</Button>
<Button
loading
variant='PRIMARY'
>
Button
</Button>
</ButtonList>

export default ButtonExample

3 changes: 2 additions & 1 deletion packages/react/components/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Button from './Button'
import { ButtonList } from './list'
import ButtonExample from './Button.example'

export * from './ButtonEnum'

export { Button, ButtonList }
export { Button, ButtonList, ButtonExample }
56 changes: 56 additions & 0 deletions packages/react/components/card/Card.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react'
import { Card, CardImage, CardContent } from './index'
import { Title, TitleLevels } from '@/components/title'
import { Text, TextLevels } from '@/components/text'
import { Button } from '@/components/button'
import { Rows, RowItem } from '@/components/rows'

const CardExample: React.ReactNode =
<Rows>
<RowItem>
<Card>
<CardImage src='https://design.bouyguestelecom.fr/v1/card-sample.200bd9f7.png' />
<CardContent>
<Title>
Présentation
</Title>
<Title level={TitleLevels.ONE}>
Title lorem
</Title>
<Text level={TextLevels.ONE}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ligula ex, neque eu,
vulputate vera.
</Text>
<Button
variant='SECONDARY'
>
Voir plus...
</Button>
</CardContent>
</Card>
</RowItem>
<RowItem>
<Card horizontal>
<CardImage src='https://design.bouyguestelecom.fr/v1/card-sample.200bd9f7.png' />
<CardContent>
<Title>
Présentation
</Title>
<Title level={TitleLevels.ONE}>
Title lorem
</Title>
<Text level={TextLevels.ONE}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ligula ex, neque eu,
vulputate vera.
</Text>
<Button
variant='SECONDARY'
>
Voir plus...
</Button>
</CardContent>
</Card>
</RowItem>
</Rows>

export default CardExample
1 change: 0 additions & 1 deletion packages/react/components/card/image/CardImage.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const CardImage = ({ src, size, alt, onClick, contain, ...others }: CardImagePro
const maxSize = horizontal ? '50%' : '100%'
const [ratio, setRatio] = useState(1)


const getBorderRadius = (isHorizontal: boolean, isReversed: boolean, isActive: boolean) => ({
borderBottomRightRadius: (isHorizontal && 1) || (isReversed && 8) || 0,
borderBottomLeftRadius: (isHorizontal && 8) || (isReversed && 8) || 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/react/components/card/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Card from './Card'
import CardImage from './image'
import CardContent from './content'
import CardExample from './Card.example'

export * from './image/CardImageEnum'

export { Card, CardImage, CardContent }
export { Card, CardImage, CardContent, CardExample }
Loading

0 comments on commit 1880d66

Please sign in to comment.