Skip to content

Commit

Permalink
feat: add calendar-header icon-card and form/full-name-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pereag committed Mar 14, 2024
1 parent d4aa885 commit e0a80a8
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/react-front-kit/components/calendar-header.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { GitHubLogo } from '../../../src/icons/GitHubLogo';

# Calendar Header

<Description
extendsInfo={[
{
label: 'CalendarHeader',
link: 'https://github.com/mantinedev/mantine/blob/master/packages/%40mantine/dates/src/components/CalendarHeader/CalendarHeader.tsx',
},
]}
importExample="import { CalendarHeader } from '@smile/react-front-kit';"
packageInfo={{
label: '@smile/react-front-kit',
link: 'https://www.npmjs.com/package/@smile/react-front-kit',
}}
sourceInfo={{
link: 'https://github.com/Smile-SA/react-front-kit/blob/main/packages/react-front-kit/src/Components/CalendarHeader/CalendarHeader.tsx',
}}
>
Renders a horizontal bar displaying the number of selected elements and an
array of [`IAction`s](../../shared-types/actions#iactiont) as
[ActionIcons](https://v6.mantine.dev/core/action-icon/)
</Description>

## Storybook Docs

<StorybookEmbed
storyId="3-custom-components-calendarheader--docs"
height="1780"
/>

## Props

CalendarHeader takes a `<Data>` generic type that extends `Record<string, unknown>`, to be used by [ActionRowOverflow](./action-row-overflow).

| Name | Type | Default | Description |
| ----------------- | ----------------------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| date <Required/> | `Date` | - | |
| label | `ReactNode` | - | |
| level <Required/> | `"month" \| "year" \| "decade"` | - | |
| onDateClick | `((event: MouseEvent<HTMLButtonElement, MouseEvent>, date: Date, level: ICalendarHeaderClickType) => void)` | - | |
| onNext | | - | |
| onPrevious | | - | |
| monthProps | `Omit<MonthProps, "month">` | - | |
| yearsListProps | `Omit<YearsListProps, "decade">` | - | |
| ... | - | - | extends [`CalendarHeader props`](https://github.com/mantinedev/mantine/blob/master/packages/%40mantine/dates/src/components/CalendarHeader/CalendarHeader.tsx) |
37 changes: 37 additions & 0 deletions docs/react-front-kit/components/icon-card.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Icon card

<Description
extendsInfo={[
{
label: 'Card',
link: 'https://mantine.dev/core/card/',
},
]}
importExample="import { IconCard } from '@smile/react-front-kit';"
packageInfo={{
label: '@smile/react-front-kit',
link: 'https://www.npmjs.com/package/@smile/react-front-kit',
}}
sourceInfo={{
link: 'https://github.com/Smile-SA/react-front-kit/blob/main/packages/react-front-kit/src/Components/IconCard/IconCard.tsx',
}}
>
Renders a horizontal bar displaying the number of selected elements and an
array of [`IAction`s](../../shared-types/actions#iactiont) as
[ActionIcons](https://v6.mantine.dev/core/action-icon/)
</Description>

## Storybook Docs

<StorybookEmbed storyId="3-custom-components-iconcard--docs" height="2020" />

## Props

| Name | Type | Default | Description |
| -------- | ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| children | `ReactNode` | - | Free area in the lower zone of the map |
| icon | `ReactNode` | - | Area in the top of the map primarily used for displaying icons but can show anything that corresponds to the ReactNode type |
| subTitle | `ReactNode` | - | SubTitle area |
| title | `ReactNode` | - | TItle area |
| color | `string` | - | Define the background color of the card. By default, the primary color is applied. Auto-contrast is used to automatically change the text color |
| ... | - | - | extends [`card props`](https://mantine.dev/core/card/?t=props). |
7 changes: 7 additions & 0 deletions docs/react-front-kit/form/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Form",
"position": 3,
"link": {
"type": "generated-index"
}
}
49 changes: 49 additions & 0 deletions docs/react-front-kit/form/full-name-fields.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Full Name Fields

<Description
extendsInfo={[
{
label: 'Flex',
link: 'https://mantine.dev/core/flex/',
},
{
label: 'TextInput',
link: 'https://mantine.dev/core/text-input/',
},
]}
importExample="import { FullNameFields } from '@smile/react-front-kit';"
packageInfo={{
label: '@smile/react-front-kit',
link: 'https://www.npmjs.com/package/@smile/react-front-kit',
}}
sourceInfo={{
link: 'https://github.com/Smile-SA/react-front-kit/blob/main/packages/react-front-kit/src/Components/FullNameFields/FullNameFields.tsx',
}}
>
Displaying a grouped input with first name and last name, usable in a
controlled manner.
</Description>

## Storybook Docs

<StorybookEmbed
storyId="3-custom-components-fullnamefields--docs"
height="820"
/>

## Props

| Name | Type | Default | Description |
| -------------- | ---------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| firstNameProps | [`TextInputProps`](https://mantine.dev/core/text-input/?t=props) | - | extends [`text input props`](https://mantine.dev/core/text-input/) If configured, the changes will apply to the firstName input |
| lastNameProps | [`TextInputProps`](https://mantine.dev/core/text-input/?t=props) | - | extends [`text input props`](https://mantine.dev/core/text-input/) If configured, the changes will apply to the lastName input |
| onChange | `((value: IFullNameFieldsValues) => void)` | - | Callback function returning the value of the input that has just been changed |
| value | `IFullNameFieldsValues` | - | Allows setting the values of the two text input fields |
| ... | - | - | extends [`flex props`](https://mantine.dev/core/flex/?t=props) |

## IFullNameFieldsValues

| Name | Type | Default | Description |
| --------- | -------- | ------- | -------------------------- |
| firstName | `string` | - | Value of `firstName` field |
| lastName | `string` | - | Value of `lastName` field |

0 comments on commit e0a80a8

Please sign in to comment.