From 1988c0baf047603043d6b3a865f78aa2ddc1f879 Mon Sep 17 00:00:00 2001 From: wpalani Date: Tue, 5 Dec 2023 08:39:33 -0700 Subject: [PATCH] Remove local section and page components --- src/app/components/page/index.js | 15 --- src/app/components/section/index.js | 159 ---------------------------- 2 files changed, 174 deletions(-) delete mode 100644 src/app/components/page/index.js delete mode 100644 src/app/components/section/index.js diff --git a/src/app/components/page/index.js b/src/app/components/page/index.js deleted file mode 100644 index 47fd63e3c..000000000 --- a/src/app/components/page/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import classNames from 'classnames'; - -export const Page = ( { className, children } ) => { - return ( -
- { children } -
- ); -}; diff --git a/src/app/components/section/index.js b/src/app/components/section/index.js deleted file mode 100644 index 03a4352af..000000000 --- a/src/app/components/section/index.js +++ /dev/null @@ -1,159 +0,0 @@ -import { Button, Title } from '@newfold/ui-component-library'; -import { useState, useEffect } from '@wordpress/element'; -import classNames from 'classnames'; - -export const SectionContainer = ( { className, children } ) => { - return ( -
- { children } -
- ); -}; - -export const SectionHeader = ( { - title, - subTitle, - className, - primaryAction = { title: false, className: false, onClick: false }, - secondaryAction = { title: false, className: false, onClick: false }, -} ) => { - return ( -
-
- { title && ( -

- { title } -

- ) } - { subTitle &&

{ subTitle }

} -
- { ( primaryAction.title || secondaryAction.title ) && ( -
- { primaryAction.title && ( - - ) } - { secondaryAction.title && ( - - ) } -
- ) } -
- ); -}; - -export const SectionContent = ( { - separator = false, - id, - className, - children, -} ) => { - const [ isTarget, setIsTarget ] = useState( false ); - const searchParams = new URLSearchParams( window.location.search ); - - useEffect( () => { - if ( - searchParams.has( 'nfd-target' ) && - searchParams.get( 'nfd-target' ) === id - ) { - setIsTarget( true ); - - setTimeout( () => { - setIsTarget( false ); - removeTargetQueryParam(); - }, 9500 ); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [ searchParams ] ); - - /* - * Remove the 'nfd-target={id}' query param from the URL - */ - const removeTargetQueryParam = () => { - searchParams.delete( 'nfd-target' ); - const currentURL = window.location.href; - const updatedURL = currentURL.replace( `&nfd-target=${ id }`, '' ); - window.history.replaceState( null, null, updatedURL ); - }; - - return ( -
-
- { children } -
-
- ); -}; - -export const SectionSettings = ( { - className, - children, - title, - description, -} ) => { - return ( -
-
-
- - { title } - - { description && ( -
{ description }
- ) } -
-
- -
- { title } -
{ children }
-
-
- ); -};