From a936883c3983efa3189adb7d3f65a2801717f4ce Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Tue, 26 Nov 2019 08:52:54 +0700 Subject: [PATCH 1/2] Add rating --- client/App.tsx | 5 +- client/Home.tsx | 1 + client/constants/Pattern.ts | 1 + client/patterns/rating/Cover.tsx | 36 +++++++++++++ client/patterns/rating/Details.tsx | 85 ++++++++++++++++++++++++++++++ client/patterns/rating/Star.tsx | 17 ++++++ client/patterns/rating/star.css | 26 +++++++++ client/placeholders/Frame.tsx | 3 +- public/sitemap.xml | 1 + 9 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 client/patterns/rating/Cover.tsx create mode 100644 client/patterns/rating/Details.tsx create mode 100644 client/patterns/rating/Star.tsx create mode 100644 client/patterns/rating/star.css diff --git a/client/App.tsx b/client/App.tsx index 7e48bbf..c124daa 100644 --- a/client/App.tsx +++ b/client/App.tsx @@ -37,9 +37,8 @@ const App = () => { - - - + + diff --git a/client/Home.tsx b/client/Home.tsx index 161903b..d95b9d5 100644 --- a/client/Home.tsx +++ b/client/Home.tsx @@ -91,6 +91,7 @@ const Home = () => { + diff --git a/client/constants/Pattern.ts b/client/constants/Pattern.ts index 5d58adf..7bec69e 100644 --- a/client/constants/Pattern.ts +++ b/client/constants/Pattern.ts @@ -21,6 +21,7 @@ enum Pattern { ProgressBar = 'Progress bar', QuestionsAndAnswers = 'Questions and answers', RadioSwitch = 'Radio switch', + Rating = 'Rating', SameHeightColumns = 'Same height columns', SearchBox = 'Search box', Separator = 'Separator', diff --git a/client/patterns/rating/Cover.tsx b/client/patterns/rating/Cover.tsx new file mode 100644 index 0000000..d25d967 --- /dev/null +++ b/client/patterns/rating/Cover.tsx @@ -0,0 +1,36 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; + +const Cover: React.FC<{}> = () => { + return ( + +
+
+
+
+
+
+
+
+
+ + ); +}; + +export default Cover; diff --git a/client/patterns/rating/Details.tsx b/client/patterns/rating/Details.tsx new file mode 100644 index 0000000..6f4ca6f --- /dev/null +++ b/client/patterns/rating/Details.tsx @@ -0,0 +1,85 @@ +import React from 'react'; + +import DetailsLayout from '../../layouts/DetailsLayout'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Star from './Star'; + +const Details: React.FC<{}> = () => { + return ( + +
+ +
+ + + + + +
+
+ )} + source={` + + +
+ + + + + +
+`} + /> + +
+ ); +}; + +export default Details; diff --git a/client/patterns/rating/Star.tsx b/client/patterns/rating/Star.tsx new file mode 100644 index 0000000..acae76c --- /dev/null +++ b/client/patterns/rating/Star.tsx @@ -0,0 +1,17 @@ +import React from 'react'; + +import './star.css'; + +interface StarProps { + isActive: boolean; +} + +const Star: React.FC = ({ isActive }) => { + return ( + + ); +}; + +export default Star; diff --git a/client/patterns/rating/star.css b/client/patterns/rating/star.css new file mode 100644 index 0000000..d44bd5b --- /dev/null +++ b/client/patterns/rating/star.css @@ -0,0 +1,26 @@ +.rating { + align-items: center; + display: flex; + font-size: 32px; + justify-content: center; + flex-direction: row-reverse; +} + +.rating .star:hover, .rating .star:hover ~ .star { + color: transparent; +} + +.rating .star:hover:before, .rating .star:hover ~ .star:before { + color: #00449e; + content: '\2605'; + left: 0; + position: absolute; +} + +.star { + background-color: transparent; + border: transparent; + margin: 0 2px; + padding: 0; + position: relative; +} diff --git a/client/placeholders/Frame.tsx b/client/placeholders/Frame.tsx index 1437ddc..e789bff 100644 --- a/client/placeholders/Frame.tsx +++ b/client/placeholders/Frame.tsx @@ -3,8 +3,9 @@ import React from 'react'; const Frame: React.FC<{}> = ({ children }) => { return (
https://csslayout.io/property-list https://csslayout.io/questions-and-answers https://csslayout.io/radio-switch + https://csslayout.io/rating https://csslayout.io/same-height-columns https://csslayout.io/search-box https://csslayout.io/separator From 724222053aa7a4f70410c2db8e2f3c7f04941fbc Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Tue, 26 Nov 2019 09:27:55 +0700 Subject: [PATCH 2/2] Tweak homepage --- client/App.tsx | 2 ++ client/Explore.tsx | 80 +++++++++++++++++++++++++++++++++++++++++++ client/Home.tsx | 84 +++++++++++++++++++++++++++++++--------------- 3 files changed, 139 insertions(+), 27 deletions(-) create mode 100644 client/Explore.tsx diff --git a/client/App.tsx b/client/App.tsx index c124daa..b145361 100644 --- a/client/App.tsx +++ b/client/App.tsx @@ -4,6 +4,7 @@ import { BrowserRouter as Router, Route, Switch as RouteSwitch } from 'react-rou import './index.css'; import Pattern from './constants/Pattern'; +import Explore from './Explore'; import Home from './Home'; import DetailsLoader from './loaders/DetailsLoader'; @@ -12,6 +13,7 @@ const App = () => { + diff --git a/client/Explore.tsx b/client/Explore.tsx new file mode 100644 index 0000000..0dfcad3 --- /dev/null +++ b/client/Explore.tsx @@ -0,0 +1,80 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +import CoverCard from './components/CoverCard'; +import Heading from './components/Heading'; +import Pattern from './constants/Pattern'; +import useDocumentTitle from './hooks/useDocumentTitle'; +import Layout from './layouts/Layout'; + +const Home = () => { + useDocumentTitle('CSS Layout ∙ Explore'); + + return ( + +
+ CSS Layout +
+
+

Explore

+ +

Here is the collection of patterns

+ +
+ + +
+ + + + + +
+
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ ); +}; + +export default Home; diff --git a/client/Home.tsx b/client/Home.tsx index d95b9d5..704974e 100644 --- a/client/Home.tsx +++ b/client/Home.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import { Link } from 'react-router-dom'; import CoverCard from './components/CoverCard'; -import Heading from './components/Heading'; import Pattern from './constants/Pattern'; import useDocumentTitle from './hooks/useDocumentTitle'; import Layout from './layouts/Layout'; @@ -20,7 +20,16 @@ const Home = () => { CSS Layout -

+

a collection of popular layouts and patterns made with CSS

@@ -54,22 +63,57 @@ const Home = () => {
-
- - -
+
+
+
+ 50+ patterns +
+ + Explore the collection + +
+
-
-
- -
- - -
@@ -90,20 +134,6 @@ const Home = () => { - - - - - - - - - - - - - -