11import React , { useState } from "react" ;
2+
3+ // Styled Component
4+ import styled from "styled-components" ;
5+
6+ // dynamic from Next.js
27import dynamic from "next/dynamic" ;
38
49// Toast
@@ -16,28 +21,91 @@ import { toPng } from 'html-to-image';
1621// downloadjs
1722import download from 'downloadjs' ;
1823
24+ // icons
25+ import { FiCopy , FiDownload , FiHeart , FiLock } from 'react-icons/fi' ;
26+
1927// Shape Listing Styled-Componentns
20- import {
21- ShapeCards ,
22- ShapeCard ,
23- ShapeName ,
24- ShapePallete ,
25- ShapeDetailsItems ,
26- ShapeCardSwitch ,
27- ShapeActions ,
28- ShapeCardHeader ,
29- CopyIcon ,
30- DownloadIcon ,
31- LikeIcon ,
32- } from './StyledComponents' ;
28+ const ShapeCards = styled . div `
29+ display: flex;
30+ flex-wrap: wrap;
31+ justify-content: center;
32+ align-items: center;
33+ ` ;
34+
35+ const ShapeCard = styled . div `
36+ width: 400px;
37+ min-height: 456px;
38+ border: 1px solid #ececec;
39+ border-radius: 4px;
40+ padding: 5px;
41+ margin: 5px;
42+ background-color: #ebebeb;
43+ ` ;
44+
45+ const ShapeActions = styled . div `
46+ float: right;
47+ ` ;
48+
49+ const ShapeName = styled . span `
50+ font-weight: bold;
51+ font-size: 20px;
52+ ` ;
53+
54+ const Playground = styled . div `
55+ width: 100%;
56+ ` ;
57+
58+ const ShapeDetails = styled . ul `
59+ background-color: #ebebeb;
60+ border-radius: 4px;
61+ padding: 10px;
62+ width: 100%;
63+ ` ;
64+
65+ const ShapeDetailsItems = styled . li `
66+ word-wrap: break-word;
67+ ` ;
68+
69+ const ShapePallete = styled . div `
70+ margin-top: 5px;
71+ ` ;
72+
73+ const ShapeCardHeader = styled . div `
74+ padding: 5px;
75+ margin: 5px;
76+ ` ;
77+
78+ const ShapeCardSwitch = styled . div `
79+ margin: 5px auto auto 9px;
80+ ` ;
81+
82+ const CopyIcon = styled ( FiCopy ) `
83+ cursor: pointer;
84+ &:hover {
85+ color: #f71b76;
86+ }
87+ ` ;
88+
89+ const DownloadIcon = styled ( FiDownload ) `
90+ cursor: pointer;
91+ &:hover {
92+ color: #f71b76;
93+ }
94+ ` ;
95+
96+ const LikeIcon = styled ( FiHeart ) `
97+ cursor: pointer;
98+ &:hover {
99+ color: #f71b6f;
100+ }
101+ ` ;
33102
34103const ShapeList = ( { data } ) => {
35104
36105 const [ shapes , setShapes ] = useState ( data ) ;
37106
38107 const handleSwicth = ( shapeName ) => {
39- console . log ( shapeName ) ;
40-
108+
41109 let modifiedShapes = shapes . map ( ( shape , index ) => {
42110 if ( shape . name === shapeName ) {
43111 return {
@@ -47,7 +115,6 @@ const ShapeList = ({ data }) => {
47115 }
48116 return shape ;
49117 } ) ;
50- console . log ( modifiedShapes ) ;
51118 setShapes ( ...[ modifiedShapes ] ) ;
52119 } ;
53120
@@ -84,6 +151,7 @@ const ShapeList = ({ data }) => {
84151 < ShapeCard >
85152 < ShapeCardHeader >
86153 < ShapeName > { shape . name } </ ShapeName >
154+ { shape . private && < FiLock /> }
87155 < ShapeActions >
88156 < span title = "Like" >
89157 < LikeIcon size = { 24 } />
@@ -111,6 +179,10 @@ const ShapeList = ({ data }) => {
111179 showShadow = { shape . showAdvanced }
112180 />
113181
182+ < div >
183+ < span > Created By { shape . createdBy } at { shape [ '__createdtime__' ] } </ span >
184+ </ div >
185+
114186 < ShapeCardSwitch >
115187 < label htmlFor = { `${ getShapeFileName ( shape . name ) } -form` } >
116188 < span > Show Clip-Path Info</ span > { " " }
0 commit comments