mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
cleanup and partial ITag
This commit is contained in:
parent
17f58daa67
commit
cb2f784ed2
3 changed files with 9 additions and 15 deletions
|
@ -4,14 +4,14 @@ import { ITag } from '~/redux/types';
|
||||||
|
|
||||||
import classNames = require('classnames');
|
import classNames = require('classnames');
|
||||||
|
|
||||||
const getTagFeature = (tag: ITag) => {
|
const getTagFeature = (tag: Partial<ITag>) => {
|
||||||
if (tag.title.substr(0, 1) === '/') return 'green';
|
if (tag.title.substr(0, 1) === '/') return 'green';
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
tag: ITag;
|
tag: Partial<ITag>;
|
||||||
|
|
||||||
is_hoverable?: boolean;
|
is_hoverable?: boolean;
|
||||||
onInput?: ChangeEventHandler<HTMLInputElement>;
|
onInput?: ChangeEventHandler<HTMLInputElement>;
|
||||||
|
|
|
@ -9,16 +9,12 @@ import React, {
|
||||||
useRef,
|
useRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { TagField } from '~/components/containers/TagField';
|
import { TagField } from '~/components/containers/TagField';
|
||||||
import { ITag, INode } from '~/redux/types';
|
import { ITag } from '~/redux/types';
|
||||||
import { Tag } from '~/components/node/Tag';
|
import { Tag } from '~/components/node/Tag';
|
||||||
import uniq from 'ramda/es/uniq';
|
import uniq from 'ramda/es/uniq';
|
||||||
import { setTimeout } from 'timers';
|
|
||||||
import length from 'ramda/es/length';
|
|
||||||
import isEmpty from 'ramda/es/isEmpty';
|
|
||||||
import symmetricDifference from 'ramda/es/symmetricDifference';
|
|
||||||
|
|
||||||
type IProps = HTMLAttributes<HTMLDivElement> & {
|
type IProps = HTMLAttributes<HTMLDivElement> & {
|
||||||
tags: ITag[];
|
tags: Partial<ITag>[];
|
||||||
is_editable?: boolean;
|
is_editable?: boolean;
|
||||||
onTagsChange?: (tags: string[]) => void;
|
onTagsChange?: (tags: string[]) => void;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,9 +19,7 @@ const EditorExample: FC<IProps> = () => (
|
||||||
<Card className={styles.wrap} seamless>
|
<Card className={styles.wrap} seamless>
|
||||||
<Group horizontal className={styles.group} seamless>
|
<Group horizontal className={styles.group} seamless>
|
||||||
<div className={styles.editor}>
|
<div className={styles.editor}>
|
||||||
<Panel
|
<Panel className={classNames(styles.editor_panel, styles.editor_image_panel)}>
|
||||||
className={classNames(styles.editor_panel, styles.editor_image_panel)}
|
|
||||||
>
|
|
||||||
<Scroll>
|
<Scroll>
|
||||||
<CellGrid className={styles.editor_image_container} size={200}>
|
<CellGrid className={styles.editor_image_container} size={200}>
|
||||||
<div className={styles.editor_image} />
|
<div className={styles.editor_image} />
|
||||||
|
@ -48,11 +46,11 @@ const EditorExample: FC<IProps> = () => (
|
||||||
|
|
||||||
<Tags
|
<Tags
|
||||||
tags={[
|
tags={[
|
||||||
{ title: 'Избранный', feature: 'red' },
|
{ title: 'Избранный' },
|
||||||
{ title: 'Плейлист', feature: 'green' },
|
{ title: 'Плейлист' },
|
||||||
{ title: 'Просто' },
|
{ title: 'Просто' },
|
||||||
{ title: '+ фото', feature: 'black' },
|
{ title: '+ фото' },
|
||||||
{ title: '+ с музыкой', feature: 'black' }
|
{ title: '+ с музыкой' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue