Skip to content

Commit

Permalink
buildIn: extensible component
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTRy committed Dec 13, 2023
1 parent 40fb87d commit 223c1bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/components/molecules/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IFancyPillProps } from '@/components/atoms/FancyPill/FancyPill.model';
// --------------------------------------------------------------------------- //
export type TChipProps = IChipProps & IFancyPillProps;
export default function Chip(props: TChipProps) {
const { size, outlined, themeType, layer, isActive, externalStyle, ...htmlProps } = props;
const { size, outlined, themeType, layer, isActive, externalStyle, children, ...htmlProps } = props;

return (
<>
Expand Down Expand Up @@ -47,8 +47,9 @@ export default function Chip(props: TChipProps) {
role={props.onClick ? 'button' : undefined}
tabIndex={0}
{...htmlProps}
></FancyPill>
<FancyBox onClick={props.onClick}></FancyBox>
>
{children}
</FancyPill>
</>
);
}
17 changes: 12 additions & 5 deletions src/components/organisms/FancyChipList/FancyChipList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ChipListProps } from './FancyChipListProps.model';
// The FancyChipList component definition
export default function FancyChipList(props: ChipListProps) {
// Destructure props and provide default values from defaultProps
const { themeType, layer, chips, inputPlaceholder, label, size, systemInformation } = {
const { themeType, layer, chips, inputPlaceholder, outlined, label, size, systemInformation } = {
...defaultProps,
...props,
};
Expand Down Expand Up @@ -58,17 +58,24 @@ export default function FancyChipList(props: ChipListProps) {
{chipsWithKeys.map((chip, index) => (
<FancyChip
key={index}
size={size}
label={chip.label}
contentEditable={editabledChip === chip.id}
tabIndex={0}
layer={Math.min((layer ?? 1) + 2, 10) as TLayer}
onDelete={deleteChip(chip.id)}
//outlined={outlined}
outlined={outlined}
onFocus={handleChipFocus(chip.id)}
onClick={handleClick}
onKeyDown={(e) => handleChipEdit(chip.id, e)}
></FancyChip>
>
<FancyChip.Img src='https://www.az-online.de/bilder/2019/08/23/12938342/2113799823-tobias-rester-2tyMMSkM2R73.jpg'/>

<FancyChip.Content>
<FancyChip.Content.Title bold={false} fontVariant="content">
{chip.label}
</FancyChip.Content.Title>
</FancyChip.Content>
<FancyChip.DeleteButton onClick={deleteChip(chip.id)} />
</FancyChip>
))}
<InputLi>
<input
Expand Down

0 comments on commit 223c1bf

Please sign in to comment.