mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed typings and props for node tags
This commit is contained in:
parent
df1c11a308
commit
f9330000c2
5 changed files with 22 additions and 19 deletions
|
@ -1,18 +1,15 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Tags } from '../Tags';
|
||||
import { ITag } from '~/redux/types';
|
||||
|
||||
interface IProps {}
|
||||
interface IProps {
|
||||
is_editable?: boolean;
|
||||
tags: ITag[];
|
||||
onChange?: (tags: string[]) => void;
|
||||
}
|
||||
|
||||
const NodeTags: FC<IProps> = ({}) => (
|
||||
<Tags
|
||||
tags={[
|
||||
{ title: 'Избранный', feature: 'red' },
|
||||
{ title: 'Плейлист', feature: 'green' },
|
||||
{ title: 'Просто' },
|
||||
{ title: '+ фото', feature: 'black' },
|
||||
{ title: '+ с музыкой', feature: 'black' },
|
||||
]}
|
||||
/>
|
||||
const NodeTags: FC<IProps> = ({ is_editable, tags, onChange }) => (
|
||||
<Tags tags={tags} is_editable={is_editable} onTagsChange={onChange} />
|
||||
);
|
||||
|
||||
export { NodeTags };
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Tag } from '~/components/node/Tag';
|
|||
type IProps = HTMLAttributes<HTMLDivElement> & {
|
||||
tags: ITag[];
|
||||
is_editable?: boolean;
|
||||
onChange?: (tags: string[]) => void;
|
||||
onTagsChange?: (tags: string[]) => void;
|
||||
};
|
||||
|
||||
export const Tags: FC<IProps> = ({ tags, is_editable, onChange, ...props }) => {
|
||||
|
@ -25,7 +25,7 @@ export const Tags: FC<IProps> = ({ tags, is_editable, onChange, ...props }) => {
|
|||
<Tag key={tag.title} title={tag.title} feature={tag.feature} />
|
||||
))}
|
||||
|
||||
<Tag title={input} onInput={onInput} />
|
||||
{is_editable && <Tag title={input} onInput={onInput} />}
|
||||
</TagField>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue