From b8e8aff61c51e93bfdad0edd1d8c9e64d1b606eb Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sat, 16 Nov 2019 11:14:31 +0700 Subject: [PATCH] Add sidebar layout --- client/App.jsx | 2 ++ client/Home.jsx | 7 ++++ client/Layout.jsx | 6 ++-- client/covers/SidebarCover.jsx | 25 ++++++++++++++ client/helpers/random.js | 2 ++ client/helpers/randomFromArray.js | 2 ++ client/helpers/shuffe.js | 6 ++++ client/layouts/Sidebar.jsx | 57 +++++++++++++++++++++++++++++++ client/placeholders/Block.jsx | 23 +++++++++++++ client/placeholders/Line.jsx | 6 ++-- client/placeholders/Rectangle.jsx | 12 +++++++ 11 files changed, 140 insertions(+), 8 deletions(-) create mode 100644 client/covers/SidebarCover.jsx create mode 100644 client/helpers/random.js create mode 100644 client/helpers/randomFromArray.js create mode 100644 client/helpers/shuffe.js create mode 100644 client/layouts/Sidebar.jsx create mode 100644 client/placeholders/Block.jsx create mode 100644 client/placeholders/Rectangle.jsx diff --git a/client/App.jsx b/client/App.jsx index 9d47369..709fd87 100644 --- a/client/App.jsx +++ b/client/App.jsx @@ -3,6 +3,7 @@ import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import Home from './Home'; import Centering from './layouts/Centering'; +import Sidebar from './layouts/Sidebar'; import StickyFooter from './layouts/StickyFooter'; import StickyHeader from './layouts/StickyHeader'; @@ -12,6 +13,7 @@ const App = () => { + diff --git a/client/Home.jsx b/client/Home.jsx index 1c4b21c..9deaeea 100644 --- a/client/Home.jsx +++ b/client/Home.jsx @@ -2,6 +2,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; import CenterCover from './covers/CenterCover'; +import SidebarCover from './covers/SidebarCover'; import StickyFooterCover from './covers/StickyFooterCover'; import StickyHeaderCover from './covers/StickyHeaderCover'; import Layout from './Layout'; @@ -30,6 +31,12 @@ const Home = () => {

Layouts

+
+ + +

Sidebar

+ +
diff --git a/client/Layout.jsx b/client/Layout.jsx index 67c38b0..c7714f8 100644 --- a/client/Layout.jsx +++ b/client/Layout.jsx @@ -11,22 +11,20 @@ const Layout = ({ children }) => { {children}
-
+
Other cool things
-
+ } + source={ + + + + + +
+ ... +
+
+`} +/> + } + /> + + ); +}; + +export default Sidebar; diff --git a/client/placeholders/Block.jsx b/client/placeholders/Block.jsx new file mode 100644 index 0000000..f5e5b52 --- /dev/null +++ b/client/placeholders/Block.jsx @@ -0,0 +1,23 @@ +import React from 'react'; + +import random from '../helpers/random'; +import Rectangle from './Rectangle'; + +const Block = ({ numberOfBlocks }) => { + return ( +
+ { + Array(numberOfBlocks).fill(0).map((_, i) => { + const s = random(1, 5); + return ( +
+ +
+ ); + }) + } +
+ ); +}; + +export default Block; diff --git a/client/placeholders/Line.jsx b/client/placeholders/Line.jsx index 1386d8d..7d41c57 100644 --- a/client/placeholders/Line.jsx +++ b/client/placeholders/Line.jsx @@ -1,12 +1,10 @@ import React from 'react'; -const Line = ({ size }) => { - const h = (size === 'medium' ? '2px' : '1px'); - +const Line = () => { return (
); }; diff --git a/client/placeholders/Rectangle.jsx b/client/placeholders/Rectangle.jsx new file mode 100644 index 0000000..6b3ba59 --- /dev/null +++ b/client/placeholders/Rectangle.jsx @@ -0,0 +1,12 @@ +import React from 'react'; + +const Rectangle = ({ height }) => { + return ( +
+ ); +}; + +export default Rectangle;