From dc24bd518206e0f52d3b5d4f6bf6cd352ae3bf49 Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sun, 1 Dec 2019 19:52:07 +0700 Subject: [PATCH 1/2] Change the background color of selected radio --- client/patterns/custom-radio-button/Cover.tsx | 2 +- client/patterns/custom-radio-button/Details.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/patterns/custom-radio-button/Cover.tsx b/client/patterns/custom-radio-button/Cover.tsx index 312a28a..891af70 100644 --- a/client/patterns/custom-radio-button/Cover.tsx +++ b/client/patterns/custom-radio-button/Cover.tsx @@ -36,7 +36,7 @@ const Cover: React.FC<{}> = () => { padding: '4px', }} > - +
diff --git a/client/patterns/custom-radio-button/Details.tsx b/client/patterns/custom-radio-button/Details.tsx index 2630f5c..c83113a 100644 --- a/client/patterns/custom-radio-button/Details.tsx +++ b/client/patterns/custom-radio-button/Details.tsx @@ -40,7 +40,7 @@ const Details: React.FC<{}> = () => {
Date: Sun, 1 Dec 2019 20:02:39 +0700 Subject: [PATCH 2/2] Add custom checkbox button --- client/constants/Pattern.ts | 1 + client/pages/ExplorePage.tsx | 1 + .../patterns/custom-checkbox-button/Cover.tsx | 79 +++++++++ .../custom-checkbox-button/Details.tsx | 159 ++++++++++++++++++ .../patterns/custom-radio-button/Details.tsx | 5 +- client/placeholders/Square.tsx | 8 +- public/sitemap.xml | 1 + 7 files changed, 251 insertions(+), 3 deletions(-) create mode 100644 client/patterns/custom-checkbox-button/Cover.tsx create mode 100644 client/patterns/custom-checkbox-button/Details.tsx diff --git a/client/constants/Pattern.ts b/client/constants/Pattern.ts index 75e92a7..82c17f1 100644 --- a/client/constants/Pattern.ts +++ b/client/constants/Pattern.ts @@ -8,6 +8,7 @@ enum Pattern { CircularNavigation = 'Circular navigation', CookieBanner = 'Cookie banner', CornerRibbon = 'Corner ribbon', + CustomCheckboxButton = 'Custom checkbox button', CustomRadioButton = 'Custom radio button', DockedAtCorner = 'Docked at corner', DotLeader = 'Dot leader', diff --git a/client/pages/ExplorePage.tsx b/client/pages/ExplorePage.tsx index 08ae0cb..19bde05 100644 --- a/client/pages/ExplorePage.tsx +++ b/client/pages/ExplorePage.tsx @@ -92,6 +92,7 @@ const ExplorePage = () => { + diff --git a/client/patterns/custom-checkbox-button/Cover.tsx b/client/patterns/custom-checkbox-button/Cover.tsx new file mode 100644 index 0000000..0b3a5f6 --- /dev/null +++ b/client/patterns/custom-checkbox-button/Cover.tsx @@ -0,0 +1,79 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; +import Rectangle from '../../placeholders/Rectangle'; +import Square from '../../placeholders/Square'; + +const Cover: React.FC<{}> = () => { + return ( + +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + ); +}; + +export default Cover; diff --git a/client/patterns/custom-checkbox-button/Details.tsx b/client/patterns/custom-checkbox-button/Details.tsx new file mode 100644 index 0000000..cda0356 --- /dev/null +++ b/client/patterns/custom-checkbox-button/Details.tsx @@ -0,0 +1,159 @@ +import React, { useState } from 'react'; + +import RelatedPatterns from '../../components/RelatedPatterns'; +import Pattern from '../../constants/Pattern'; +import DetailsLayout from '../../layouts/DetailsLayout'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Rectangle from '../../placeholders/Rectangle'; + +interface CheckboxProps { + isChecked: boolean; + value: string; +} + +const Details: React.FC<{}> = () => { + const Checkbox: React.FC = ({ isChecked, value, children }) => { + const [checked, setChecked] = useState(isChecked); + const click = () => setChecked((c) => !c); + + return ( +
+ ); }; diff --git a/client/placeholders/Square.tsx b/client/placeholders/Square.tsx index e35d9df..8ced485 100644 --- a/client/placeholders/Square.tsx +++ b/client/placeholders/Square.tsx @@ -1,14 +1,18 @@ import React from 'react'; interface SquareProps { + backgroundColor?: string; size?: number; } -const Square: React.FC = ({ size = 8 }) => { +const Square: React.FC = ({ + backgroundColor = 'rgba(0, 0, 0, 0.3)', + size = 8, +}) => { return (
https://csslayout.io/patterns/circular-navigation https://csslayout.io/patterns/cookie-banner https://csslayout.io/patterns/corner-ribbon + https://csslayout.io/patterns/custom-checkbox-button https://csslayout.io/patterns/custom-radio-button https://csslayout.io/patterns/docked-at-corner https://csslayout.io/patterns/dot-leader