From 4a9cf28660ed3b7e02952d02035978d1d4ad3e7e Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 9 Dec 2020 23:26:30 +0100 Subject: add creator 2nd step & onKeyPress helper --- client/src/admin/jsx/creator/Step1.jsx | 51 ++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 9 deletions(-) (limited to 'client/src/admin/jsx/creator/Step1.jsx') diff --git a/client/src/admin/jsx/creator/Step1.jsx b/client/src/admin/jsx/creator/Step1.jsx index 647661e..3e2e05d 100644 --- a/client/src/admin/jsx/creator/Step1.jsx +++ b/client/src/admin/jsx/creator/Step1.jsx @@ -1,11 +1,23 @@ import React, { useState } from 'react'; import { WithHover, t, goTo } from '../../hocs'; +import { onKeyPress } from '../../helpers' -const Step1 = () => { - const [websiteTitle, setWebsiteTitle] = useState(''); - const [websiteDescription, setWebsiteDescription] = useState(''); +const Step1 = ({ setStep, data, setData }) => { + const [websiteTitle, setWebsiteTitle] = useState(data.websiteTitle || ''); + const [websiteDescription, setWebsiteDescription] = useState(data.websiteDescription || ''); const isNextActive = websiteTitle.length > 2 && websiteDescription.length > 2 ? 'active' : ''; + const uploadFavicon = () => ( + console.log('this will upload favicon') + ) + + const handleNext = () => { + if (isNextActive) { + setData({ ...data, websiteTitle, websiteDescription }); + setStep('step2'); + } + } + return (
{ t('main-information') }
@@ -21,7 +33,9 @@ const Step1 = () => { className="text-input-field" value={websiteTitle} /> - +
@@ -32,16 +46,25 @@ const Step1 = () => { onChange={e => setWebsiteDescription(e.target.value)} id="website-description" name="website-description" - placeholder={t('website-description')}> + placeholder={t('website-description')} + value={websiteDescription} + > - +
-
+
+
+
{t('upload-favicon')} @@ -50,12 +73,22 @@ const Step1 = () => {
-
+
{t('cancel')}
-
+
{t('next')}
-- cgit v1.2.3