Skip to content

Commit

Permalink
feat: add modifierContent to <FormField /> (#16)
Browse files Browse the repository at this point in the history
* feat: add modifierContent prop

* fix: remove unused import

---------

Co-authored-by: Luca Tagliabue <[email protected]>
  • Loading branch information
lucataglia and Luca Tagliabue authored Nov 15, 2024
1 parent 19e1dbe commit 5ca0fd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/lib/components/drawer-list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DataTable } from '@Components/data-table';
import Drawer from '@Components/drawer';
import Spin from '@Components/spin';
import classNames from 'classnames';
import { memo } from 'react';

Expand Down Expand Up @@ -46,7 +45,7 @@ const DrawerList = <T extends Record<string, unknown>, >({
modifier={`c-drawer-list__wrapper ${
!mask ? 'c-drawer--transparent-mask' : ''
} ${modifier} ${mode} ${css}`}
title={<Spin spinning={loading}>{header}</Spin>}
title={header}
open={open}
onClose={onClose}
closable={false}
Expand Down
8 changes: 6 additions & 2 deletions src/lib/components/form-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,27 @@ import classNames from 'classnames';
import React, { memo } from 'react';

type Props = {
className?: string,
children?: React.ReactNode;
description?: string;
flexColumn?: boolean;
label?: string | React.ReactNode;
message?: string | React.ReactNode;
modifier?: string;
modifierContent?: string;
required?: boolean;
messageColor?: 'warning' | 'success' | 'error';
};

const FormField = ({
children,
className = '',
flexColumn,
description,
label,
message,
modifier = '',
modifierContent = '',
required,
messageColor = 'error',
}: Props) => {
Expand All @@ -33,7 +37,7 @@ const FormField = ({
});

return (
<div className={`c-form-field ${modifier}`}>
<div className={`c-form-field ${className} ${modifier}`}>
{label && (
<div className="c-form-field__label">
<label>
Expand All @@ -49,7 +53,7 @@ const FormField = ({
</div>
)}

<div className={`c-form-field__content ${cssContent}`}>{children}</div>
<div className={`c-form-field__content ${modifierContent} ${cssContent}`}>{children}</div>

{message && (
<span
Expand Down

0 comments on commit 5ca0fd0

Please sign in to comment.