From 234ae1c88c3db0aa4bda41fba70dbb25ed455908 Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sun, 18 Apr 2021 14:32:04 +0700 Subject: [PATCH] Create a zigzag timeline --- client/constants/Pattern.ts | 1 + client/pages/ExplorePage.tsx | 1 + client/patterns/zigzag-timeline/Cover.tsx | 79 ++++++++++ client/patterns/zigzag-timeline/Details.tsx | 135 ++++++++++++++++++ .../zigzag-timeline/zigzag-timeline.css | 48 +++++++ public/sitemap.xml | 4 + 6 files changed, 268 insertions(+) create mode 100644 client/patterns/zigzag-timeline/Cover.tsx create mode 100644 client/patterns/zigzag-timeline/Details.tsx create mode 100644 client/patterns/zigzag-timeline/zigzag-timeline.css diff --git a/client/constants/Pattern.ts b/client/constants/Pattern.ts index 40428c5..68ed829 100644 --- a/client/constants/Pattern.ts +++ b/client/constants/Pattern.ts @@ -101,6 +101,7 @@ enum Pattern { Voting = 'Voting', Watermark = 'Watermark', Wizard = 'Wizard', + ZigzagTimeline = 'Zigzag timeline', } export default Pattern; diff --git a/client/pages/ExplorePage.tsx b/client/pages/ExplorePage.tsx index 343caca..4f94f09 100644 --- a/client/pages/ExplorePage.tsx +++ b/client/pages/ExplorePage.tsx @@ -159,6 +159,7 @@ const ExplorePage = () => { + diff --git a/client/patterns/zigzag-timeline/Cover.tsx b/client/patterns/zigzag-timeline/Cover.tsx new file mode 100644 index 0000000..731839a --- /dev/null +++ b/client/patterns/zigzag-timeline/Cover.tsx @@ -0,0 +1,79 @@ +/** + * A collection of popular layouts and patterns made with CSS (https://csslayout.io) + * (c) 2019 - 2021 Nguyen Huu Phuoc + */ + +import * as React from 'react'; + +import Frame from '../../placeholders/Frame'; +import Line from '../../placeholders/Line'; +import Rectangle from '../../placeholders/Rectangle'; + +const Cover: React.FC<{}> = () => { + return ( + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + ); +}; + +export default Cover; diff --git a/client/patterns/zigzag-timeline/Details.tsx b/client/patterns/zigzag-timeline/Details.tsx new file mode 100644 index 0000000..8ee9500 --- /dev/null +++ b/client/patterns/zigzag-timeline/Details.tsx @@ -0,0 +1,135 @@ +/** + * A collection of popular layouts and patterns made with CSS (https://csslayout.io) + * (c) 2019 - 2021 Nguyen Huu Phuoc + */ + +import * as React from 'react'; +import { Helmet } from 'react-helmet'; +import Pattern from '../../constants/Pattern'; + +import DetailsLayout from '../../layouts/DetailsLayout'; +import Block from '../../placeholders/Block'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Rectangle from '../../placeholders/Rectangle'; + +import './zigzag-timeline.css'; + +const Details: React.FC<{}> = () => { + return ( + + + + + + + +
+ + +
...
+ + + ... +
+ + +... +`} +css={` +.zigzag-timeline__item { + /* Used to position the milestone */ + position: relative; + + /* Border */ + border-bottom: 1px solid #71717A; + + /* Take full width */ + width: 100%; +} + +.zigzag-timeline__milestone { + /* Absolute position */ + position: absolute; + top: 50%; + + /* Circle it */ + border-radius: 50%; + height: 2rem; + width: 2rem; + + /* Misc */ + background: #71717A; +} + +/* Styles for even items */ +.zigzag-timeline__item:nth-child(2n) { + border-left: 1px solid #71717A; + +} +.zigzag-timeline__item:nth-child(2n) .zigzag-timeline__milestone { + left: 0; + transform: translate(-50%, -50%); +} + +/* Styles for odd items */ +.zigzag-timeline__item:nth-child(2n + 1) { + border-right: 1px solid #71717A; +} +.zigzag-timeline__item:nth-child(2n + 1) .zigzag-timeline__milestone { + right: 0; + transform: translate(50%, -50%); +} +`} + > +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+ + ); +}; + +export default Details; diff --git a/client/patterns/zigzag-timeline/zigzag-timeline.css b/client/patterns/zigzag-timeline/zigzag-timeline.css new file mode 100644 index 0000000..46cbfde --- /dev/null +++ b/client/patterns/zigzag-timeline/zigzag-timeline.css @@ -0,0 +1,48 @@ +/** + * A collection of popular layouts and patterns made with CSS (https://csslayout.io) + * (c) 2019 - 2021 Nguyen Huu Phuoc + */ + +.zigzag-timeline__item { + /* Used to position the milestone */ + position: relative; + + /* Border */ + border-bottom: 1px solid #71717A; + + /* Take full width */ + width: 100%; +} + +.zigzag-timeline__milestone { + /* Absolute position */ + position: absolute; + top: 50%; + + /* Circle it */ + border-radius: 50%; + height: 2rem; + width: 2rem; + + /* Misc */ + background: #71717A; +} + +/* Styles for even items */ +.zigzag-timeline__item:nth-child(2n) { + border-left: 1px solid #71717A; + +} +.zigzag-timeline__item:nth-child(2n) .zigzag-timeline__milestone { + left: 0; + transform: translate(-50%, -50%); +} + +/* Styles for odd items */ +.zigzag-timeline__item:nth-child(2n + 1) { + border-right: 1px solid #71717A; +} +.zigzag-timeline__item:nth-child(2n + 1) .zigzag-timeline__milestone { + right: 0; + transform: translate(50%, -50%); +} \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml index 30926f6..79cbf99 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -1,5 +1,8 @@ + https://csslayout.io https://csslayout.io/patterns + + https://csslayout.io/patterns/accordion https://csslayout.io/patterns/arrow-buttons https://csslayout.io/patterns/avatar @@ -97,4 +100,5 @@ https://csslayout.io/patterns/voting https://csslayout.io/patterns/watermark https://csslayout.io/patterns/wizard + https://csslayout.io/patterns/zigzag-timeline \ No newline at end of file