diff --git a/src/components/RightSidebar/RightSidebar.js b/src/components/RightSidebar/RightSidebar.js index 1ca90de4..a1d9a42e 100644 --- a/src/components/RightSidebar/RightSidebar.js +++ b/src/components/RightSidebar/RightSidebar.js @@ -16,8 +16,8 @@ const RightSidebar = () => { const { state, dispatch } = context; const { data, theme } = state; - const tabs = [t('templates.title'), 'Colors', 'Fonts', 'Actions', 'About']; - const [currentTab, setCurrentTab] = useState(t('templates.title')); + const tabs = [t('templates.title'), t('colors.title'), 'Fonts', 'Actions', 'About']; + const [currentTab, setCurrentTab] = useState(t('colors.title')); const onChange = (key, value) => { dispatch({ type: 'on_input', @@ -34,7 +34,7 @@ const RightSidebar = () => { switch (currentTab) { case t('templates.title'): return ; - case 'Colors': + case t('colors.title'): return ; case 'Fonts': return ; diff --git a/src/components/RightSidebar/tabs/Colors.js b/src/components/RightSidebar/tabs/Colors.js index 7d79b663..c1c004fa 100644 --- a/src/components/RightSidebar/tabs/Colors.js +++ b/src/components/RightSidebar/tabs/Colors.js @@ -1,5 +1,6 @@ import React from 'react'; import { toast } from 'react-toastify'; +import { useTranslation } from 'react-i18next'; import TextField from '../../../shared/TextField'; import { copyToClipboard } from '../../../utils'; @@ -30,9 +31,11 @@ const colorOptions = [ ]; const ColorsTab = ({ theme, onChange }) => { + const { t } = useTranslation('rightSidebar'); + const copyColorToClipboard = color => { copyToClipboard(color); - toast(`Color ${color} copied to clipboard.`, { + toast(t('colors.clipboardCopyAction', { color }), { bodyClassName: 'text-center text-gray-800 py-2', }); onChange('theme.colors.accent', color); @@ -41,7 +44,7 @@ const ColorsTab = ({ theme, onChange }) => { return (
- Color Options + {t('colors.colorOptions')}
{colorOptions.map(color => ( @@ -56,22 +59,6 @@ const ColorsTab = ({ theme, onChange }) => {
- {/*
-
-
- onChange('theme.colors.background', v)} - /> -
-
*/} -
{ />
onChange('theme.colors.primary', v)} @@ -94,7 +81,7 @@ const ColorsTab = ({ theme, onChange }) => { />
onChange('theme.colors.accent', v)} diff --git a/src/i18n/resources/en/rightSidebar/colors.json b/src/i18n/resources/en/rightSidebar/colors.json new file mode 100644 index 00000000..f89e57b6 --- /dev/null +++ b/src/i18n/resources/en/rightSidebar/colors.json @@ -0,0 +1,7 @@ +{ + "title": "Colors", + "colorOptions": "Color Options", + "primaryColor": "Primary Color", + "accentColor": "Accent Color", + "clipboardCopyAction": "{{color}} has been copied to clipboard." +} diff --git a/src/i18n/resources/en/rightSidebar/index.js b/src/i18n/resources/en/rightSidebar/index.js index c3a0bcc3..0be98600 100644 --- a/src/i18n/resources/en/rightSidebar/index.js +++ b/src/i18n/resources/en/rightSidebar/index.js @@ -1,5 +1,7 @@ import templates from './templates.json'; +import colors from './colors.json'; export default { templates, + colors, };