From 3eaab3b42786d28a3effe3104c66ad1b8a805855 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Thu, 9 Jul 2020 20:06:49 +0530 Subject: [PATCH] - implement colors section --- src/components/builder/right/RightSidebar.js | 3 +++ .../builder/right/sections/Colors.js | 21 +++++++++++++++++++ .../builder/right/sections/Colors.module.css | 11 ++++++++++ src/components/shared/Input.js | 16 ++++++++++++++ src/components/shared/Input.module.css | 9 ++++++++ src/data/colors.js | 20 ++++++++++++++++++ src/data/rightSections.js | 7 ++++++- 7 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/data/colors.js diff --git a/src/components/builder/right/RightSidebar.js b/src/components/builder/right/RightSidebar.js index 1c04e494..2b9f4249 100644 --- a/src/components/builder/right/RightSidebar.js +++ b/src/components/builder/right/RightSidebar.js @@ -3,6 +3,7 @@ import { Element } from 'react-scroll'; import sections from '../../../data/rightSections'; import RightNavbar from './RightNavbar'; import styles from './RightSidebar.module.css'; +import Colors from './sections/Colors'; import Layout from './sections/Layout'; import Templates from './sections/Templates'; @@ -12,6 +13,8 @@ const getComponent = (id) => { return Templates; case 'layout': return Layout; + case 'colors': + return Colors; default: throw new Error(); } diff --git a/src/components/builder/right/sections/Colors.js b/src/components/builder/right/sections/Colors.js index 59b9504a..54492cd7 100644 --- a/src/components/builder/right/sections/Colors.js +++ b/src/components/builder/right/sections/Colors.js @@ -1,7 +1,11 @@ +/* eslint-disable jsx-a11y/control-has-associated-label */ import React, { memo } from 'react'; import { useDispatch } from '../../../../contexts/ResumeContext'; +import colors from '../../../../data/colors'; +import { handleKeyUp } from '../../../../utils'; import Heading from '../../../shared/Heading'; import Input from '../../../shared/Input'; +import styles from './Colors.module.css'; const Colors = () => { const dispatch = useDispatch(); @@ -20,7 +24,22 @@ const Colors = () => {
Colors +
+ {colors.map((color) => ( +
handleKeyUp(e, () => handleClick(color))} + onClick={() => handleClick(color)} + /> + ))} +
+ { /> { /> )} + {type === 'color' && ( +
+
+ + +
+ )} + {error && touched &&

{error}

}
diff --git a/src/components/shared/Input.module.css b/src/components/shared/Input.module.css index 6848fc79..dfd09688 100644 --- a/src/components/shared/Input.module.css +++ b/src/components/shared/Input.module.css @@ -29,3 +29,12 @@ .container label > p { @apply mt-1 text-red-600 text-xs; } + +.circle { + left: 14px; + @apply absolute bg-white rounded-full w-6 h-6; +} + +div.circle + input { + padding-left: 44px; +} \ No newline at end of file diff --git a/src/data/colors.js b/src/data/colors.js new file mode 100644 index 00000000..29051447 --- /dev/null +++ b/src/data/colors.js @@ -0,0 +1,20 @@ +const colors = [ + '#f44336', + '#E91E63', + '#9C27B0', + '#673AB7', + '#3F51B5', + '#2196F3', + '#03A9F4', + '#00BCD4', + '#009688', + '#4CAF50', + '#8BC34A', + '#CDDC39', + '#FFEB3B', + '#FFC107', + '#FF9800', + '#FF5722', +]; + +export default colors; diff --git a/src/data/rightSections.js b/src/data/rightSections.js index aa5ccd53..11dee8e2 100644 --- a/src/data/rightSections.js +++ b/src/data/rightSections.js @@ -1,4 +1,4 @@ -import { MdDashboard, MdStyle } from 'react-icons/md'; +import { MdColorLens, MdDashboard, MdStyle } from 'react-icons/md'; export default [ { @@ -11,4 +11,9 @@ export default [ name: 'Layout', icon: MdDashboard, }, + { + id: 'colors', + name: 'Colors', + icon: MdColorLens, + }, ];