1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

Tags component

This commit is contained in:
muerwre 2019-07-27 18:28:28 +07:00
parent c13c0fcc3c
commit 9435df5b10
6 changed files with 39 additions and 11 deletions

View file

@ -45,7 +45,6 @@
} }
} }
} }
.btn { .btn {
height: 54px; height: 54px;
box-shadow: inset transparentize(black, 0.9) 0 -1px, inset transparentize(white, 0.95) 0 1px; box-shadow: inset transparentize(black, 0.9) 0 -1px, inset transparentize(white, 0.95) 0 1px;

View file

@ -26,7 +26,6 @@
&:global(.green) { &:global(.green) {
background: $green_gradient; background: $green_gradient;
color: transparentize(black, 0.4);
} }
&:global(.olive) { &:global(.olive) {

View file

@ -0,0 +1,25 @@
import React, {FC, HTMLAttributes} from 'react';
import {TagField} from "~/components/containers/TagField";
import {ITag} from "~/redux/types";
import {Tag} from "~/components/node/Tag";
type IProps = HTMLAttributes<HTMLDivElement> & {
tags: ITag[];
}
export const Tags: FC<IProps> = ({
tags,
...props
}) => (
<TagField {...props}>
{
tags.map(tag => (
<Tag
key={tag.title}
title={tag.title}
feature={tag.feature}
/>
))
}
</TagField>
);

View file

@ -10,6 +10,7 @@ import { Filler } from "~/components/containers/Filler";
import { Tag } from "~/components/node/Tag"; import { Tag } from "~/components/node/Tag";
import { TagField } from "~/components/containers/TagField"; import { TagField } from "~/components/containers/TagField";
import {NodeRelated} from "~/components/node/NodeRelated"; import {NodeRelated} from "~/components/node/NodeRelated";
import {Tags} from "~/components/node/Tags";
interface IProps {} interface IProps {}
@ -82,13 +83,17 @@ const ImageExample: FC<IProps> = () => (
</Group> </Group>
</Padder> </Padder>
<TagField> {
<Tag title="Избранный" feature="red" /> <Tags
<Tag title="Плэйлист" feature="green" /> tags={[
<Tag title="Tag" /> { title: 'Избранный', feature: 'red' },
<Tag title="Фотография" feature="black" /> { title: 'Плейлист', feature: 'green' },
<Tag title="С музыкой" feature="black" /> { title: 'Просто' },
</TagField> { title: '+ фото', feature: 'black' },
{ title: '+ с музыкой', feature: 'black' },
]}
/>
}
<NodeRelated <NodeRelated
title="First album" title="First album"

View file

@ -1,4 +1,4 @@
export type ITag = { export type ITag = {
title: string; title: string;
feature: 'red' | 'blue' | 'green' | 'olive' | 'black'; feature?: 'red' | 'blue' | 'green' | 'olive' | 'black';
} }

View file

@ -9,7 +9,7 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const htmlPlugin = new HtmlWebPackPlugin({ const htmlPlugin = new HtmlWebPackPlugin({
template: './src/index.html', template: './src/index.html',
filename: './index.html', filename: './index.html',
title: 'Empty React Project', title: 'VLT',
hash: false, hash: false,
// favicon: 'src/sprites/favicon.png', // favicon: 'src/sprites/favicon.png',
}); });