From 1a3e57b57ddc4c4b37284476f8ea44dfe7128760 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 8 Nov 2023 18:27:33 +0530 Subject: [PATCH 01/14] Code Dump --- .../components/AIHeading/index.js | 10 +++ .../components/AIHeading/stylesheet.scss | 24 ++++++ .../TextInput/TextInputSiteGen/index.js | 86 +++++++++++++++++++ .../TextInputSiteGen/stylesheet.scss | 66 ++++++++++++++ .../steps/SiteGen/SiteDetails/contents.js | 17 ++++ .../steps/SiteGen/SiteDetails/index.js | 35 ++++++-- .../steps/SiteGen/SiteDetails/stylesheet.scss | 16 ++++ src/OnboardingSPA/styles/app.scss | 5 +- 8 files changed, 249 insertions(+), 10 deletions(-) create mode 100644 src/OnboardingSPA/components/AIHeading/index.js create mode 100644 src/OnboardingSPA/components/AIHeading/stylesheet.scss create mode 100644 src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js create mode 100644 src/OnboardingSPA/components/TextInput/TextInputSiteGen/stylesheet.scss create mode 100644 src/OnboardingSPA/steps/SiteGen/SiteDetails/contents.js create mode 100644 src/OnboardingSPA/steps/SiteGen/SiteDetails/stylesheet.scss diff --git a/src/OnboardingSPA/components/AIHeading/index.js b/src/OnboardingSPA/components/AIHeading/index.js new file mode 100644 index 000000000..93fd2b8d3 --- /dev/null +++ b/src/OnboardingSPA/components/AIHeading/index.js @@ -0,0 +1,10 @@ +const AIHeading = ( { title } ) => { + return ( +
+
+
{ title }
+
+ ); +}; + +export default AIHeading; diff --git a/src/OnboardingSPA/components/AIHeading/stylesheet.scss b/src/OnboardingSPA/components/AIHeading/stylesheet.scss new file mode 100644 index 000000000..6072bdc03 --- /dev/null +++ b/src/OnboardingSPA/components/AIHeading/stylesheet.scss @@ -0,0 +1,24 @@ +.ai-heading { + + display: flex; + margin-bottom: 20px; + align-items: center; + + &--icon { + width: 50px; + margin: 4px; + height: 50px; + background-size: 200%; + background-position: center; + background-repeat: no-repeat; + background-image: var(--ai-logo); + } + + &--title { + margin: 10px; + line-height: 1.5; + font-weight: 500; + font-size: 1.4rem; + color: var(--nfd-onboarding-primary); + } +} diff --git a/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js b/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js new file mode 100644 index 000000000..c213f45ec --- /dev/null +++ b/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js @@ -0,0 +1,86 @@ +import classNames from 'classnames'; +import { useRef, useEffect, useState, memo } from '@wordpress/element'; + +const TextInputSiteGen = ( { + hint, + height, + placeholder, + customerInput, + setCustomerInput, +} ) => { + const textareaRef = useRef( null ); + const [ inputText, setInputText ] = useState( 'nfd-sg-input-box__field' ); + + useEffect( () => { + textareaRef.current.style.height = height; + const scrollHeight = textareaRef.current.scrollHeight; + textareaRef.current.style.height = scrollHeight + 'px'; + }, [ customerInput ] ); + + const calculateDetail = ( num ) => { + const selectedButton = 'nfd-sg-input-box__info-icon--selected'; + switch ( num ) { + case 1: + if ( customerInput?.length > 30 ) return selectedButton; + break; + case 2: + if ( customerInput?.length > 60 ) return selectedButton; + break; + case 3: + if ( customerInput?.length > 100 ) return selectedButton; + } + }; + + const onTextChange = ( e ) => { + e.preventDefault(); + setCustomerInput( e.target.value ); + setInputText( 'nfd-sg-input-box__field' ); + }; + + return ( +
+