From 1a7557eab4d677352e8bc8c6c9a1ffb70e82b2db Mon Sep 17 00:00:00 2001 From: muerwre Date: Sat, 27 Jul 2019 06:33:06 +0700 Subject: [PATCH] node related images --- src/components/node/NodePanel/styles.scss | 8 ++-- src/components/node/NodeRelated/index.tsx | 25 ++++++++++++ src/components/node/NodeRelated/styles.scss | 38 +++++++++++++++++++ src/components/node/Tag/index.tsx | 13 +++++-- src/components/node/Tag/styles.scss | 5 +++ .../examples/ImageExample/index.tsx | 22 ++++++++--- src/redux/types.ts | 4 ++ src/styles/variables.scss | 2 +- 8 files changed, 102 insertions(+), 15 deletions(-) create mode 100644 src/components/node/NodeRelated/index.tsx create mode 100644 src/components/node/NodeRelated/styles.scss create mode 100644 src/redux/types.ts diff --git a/src/components/node/NodePanel/styles.scss b/src/components/node/NodePanel/styles.scss index 5829de1a..75abcab4 100644 --- a/src/components/node/NodePanel/styles.scss +++ b/src/components/node/NodePanel/styles.scss @@ -1,16 +1,14 @@ .wrap { - //height: $node_title_height; - //background: $node_title_background; - background: transparentize(black, 0.9); + background: #090909; padding: $gap; box-sizing: border-box; display: flex; align-items: center; justify-content: stretch; - //border-radius: $radius $radius 0 0; - //box-shadow: transparentize(black, 0.3) 0 2px, inset transparentize(white, 0.98) 0 1px; + border-radius: $cell_radius $cell_radius 0 0; box-shadow: transparentize(white, 0.97) 0 1px, inset transparentize(white, 0.97) 0 1px; position: relative; + margin-top: -$radius; } .title { diff --git a/src/components/node/NodeRelated/index.tsx b/src/components/node/NodeRelated/index.tsx new file mode 100644 index 00000000..98bf666f --- /dev/null +++ b/src/components/node/NodeRelated/index.tsx @@ -0,0 +1,25 @@ +import React, {FC, HTMLAttributes} from 'react'; +import { range } from 'ramda'; +import * as styles from './styles.scss'; +import {Group} from "~/components/containers/Group"; + +type IProps = HTMLAttributes & {} + +const NodeRelated: FC = ({ + title, +}) => ( + +
+
+
{title}
+
+
+
+ { + range(1,7).map(el => (
)) + } +
+ +); + +export { NodeRelated }; diff --git a/src/components/node/NodeRelated/styles.scss b/src/components/node/NodeRelated/styles.scss new file mode 100644 index 00000000..6ff356b0 --- /dev/null +++ b/src/components/node/NodeRelated/styles.scss @@ -0,0 +1,38 @@ +.wrap { + padding: $gap; + background: transparentize(black, 0.8); +} + +.grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); + grid-template-rows: auto; + grid-auto-rows: auto; + grid-column-gap: $gap; + grid-row-gap: $gap; +} + +.item { + background: #222222; + padding-bottom: 100%; + border-radius: $cell_radius; +} + +.title { + font: $font_14_semibold; + text-transform: uppercase; + color: transparentize(white, 0.7); + flex-direction: row; + display: flex; + align-items: center; +} + +.line { + flex: 1; + height: 2px; + background: transparentize(white, 0.95); +} + +.text { + margin: 0 $gap; +} diff --git a/src/components/node/Tag/index.tsx b/src/components/node/Tag/index.tsx index 51123d50..7cfbbfaa 100644 --- a/src/components/node/Tag/index.tsx +++ b/src/components/node/Tag/index.tsx @@ -1,17 +1,22 @@ import React, { FC } from 'react'; import * as styles from './styles.scss'; import classNames = require("classnames"); +import {ITag} from "~/redux/types"; interface IProps { - title: string; - color?: 'red' | 'blue' | 'green' | 'olive' | 'black'; + title: ITag['title']; + feature?: ITag['feature']; + + is_hoverable?: boolean; } const Tag: FC = ({ title, - color, + feature, + + is_hoverable, }) => ( -
+
{title}
diff --git a/src/components/node/Tag/styles.scss b/src/components/node/Tag/styles.scss index 3f6b0e0d..2a4a76db 100644 --- a/src/components/node/Tag/styles.scss +++ b/src/components/node/Tag/styles.scss @@ -12,6 +12,10 @@ box-shadow: $shadow_depth_2; margin: ($gap / 2) $gap ($gap / 2) 0; + &:global(.is_hoverable) { + cursor: pointer; + } + &:global(.red) { background: $red; } @@ -35,6 +39,7 @@ background: transparentize(black, 0.7); box-shadow: none; color: transparentize(white, 0.6); + font: $font_12_medium; .hole::after { background: transparentize(white, 0.98); } } diff --git a/src/containers/examples/ImageExample/index.tsx b/src/containers/examples/ImageExample/index.tsx index 1967e401..c56b29c7 100644 --- a/src/containers/examples/ImageExample/index.tsx +++ b/src/containers/examples/ImageExample/index.tsx @@ -9,6 +9,7 @@ import { NodePanel } from "~/components/node/NodePanel"; import { Filler } from "~/components/containers/Filler"; import { Tag } from "~/components/node/Tag"; import { TagField } from "~/components/containers/TagField"; +import {NodeRelated} from "~/components/node/NodeRelated"; interface IProps {} @@ -82,13 +83,24 @@ const ImageExample: FC = () => ( + + + + - - - - - + + + + + +
+ +
diff --git a/src/redux/types.ts b/src/redux/types.ts new file mode 100644 index 00000000..7c91b303 --- /dev/null +++ b/src/redux/types.ts @@ -0,0 +1,4 @@ +export type ITag = { + title: string; + feature: 'red' | 'blue' | 'green' | 'olive' | 'black'; +} diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 11708e31..ec94aa5c 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -55,7 +55,7 @@ $shadow_depth_2: transparentize(black, 0.8) 0 2px, inset transparentize(white, 0 $comment_shadow: $shadow_depth_2; $node_shadow: transparentize(black, 0.8) 1px 2px; -$tag_height: 24px; +$tag_height: 22px; @mixin outer_shadow() { box-shadow: inset transparentize(white, 0.95) 0 1px,