From 386b03133d0987fc10a00954f212740a574bb40e Mon Sep 17 00:00:00 2001 From: Eitan Elbaz Date: Tue, 27 Jun 2023 16:02:49 +0100 Subject: [PATCH] start on new playground page --- playground/src/App.tsx | 4 + playground/src/pages/HiddenComponents.tsx | 27 +++++++ playground/src/pages/index.ts | 1 + playground/src/routes.ts | 1 + playground/src/tours/Home.tsx | 99 +++++++++++++++++++++++ 5 files changed, 132 insertions(+) create mode 100644 playground/src/pages/HiddenComponents.tsx diff --git a/playground/src/App.tsx b/playground/src/App.tsx index d612c09..dd3b517 100644 --- a/playground/src/App.tsx +++ b/playground/src/App.tsx @@ -5,6 +5,7 @@ import { Routes } from 'routes'; import Home from './pages/Home'; import CustomExample from './pages/CustomExample'; import GitHubBtn from './components/GitHubBtn'; +import HiddenComponents from './pages/HiddenComponents'; const App = () => ( @@ -34,6 +35,9 @@ const App = () => ( + + + diff --git a/playground/src/pages/HiddenComponents.tsx b/playground/src/pages/HiddenComponents.tsx new file mode 100644 index 0000000..d835651 --- /dev/null +++ b/playground/src/pages/HiddenComponents.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { Box } from '@material-ui/core'; +import { ReactGrandTour } from 'react-grand-tour'; +import KitchenSink from 'components/KitchenSink'; +import Hero from 'components/Hero'; +import { HiddenComponentsTour } from 'tours'; + +const HiddenComponents = () => ( + + + + + + +); + +export default HiddenComponents; diff --git a/playground/src/pages/index.ts b/playground/src/pages/index.ts index 8794c86..d391109 100644 --- a/playground/src/pages/index.ts +++ b/playground/src/pages/index.ts @@ -1,2 +1,3 @@ export { default as Home } from './Home'; export { default as CustomExample } from './CustomExample'; +export { default as HiddenComponents } from './HiddenComponents'; diff --git a/playground/src/routes.ts b/playground/src/routes.ts index 5d50689..b1a8749 100644 --- a/playground/src/routes.ts +++ b/playground/src/routes.ts @@ -1,4 +1,5 @@ export const Routes = { home: '/ReactGrandTour', custom: '/ReactGrandTour/custom', + hiddenComponents: '/ReactGrandTour/hidden', }; diff --git a/playground/src/tours/Home.tsx b/playground/src/tours/Home.tsx index cfc025e..175aa86 100644 --- a/playground/src/tours/Home.tsx +++ b/playground/src/tours/Home.tsx @@ -155,3 +155,102 @@ export const HomeSteps: ReactGrandTourStep[] = [ component: Bye, }, ]; + +export const HiddenComponentsTour: ReactGrandTourStep[] = [ + // { + // selector: `#${HomeStepIds.one}`, + // content: 'Welcome to React Grand Tour!', + // component: Hello, + // }, + { + selector: `#${HomeStepIds.one}`, + content: 'Welcome to React Grand Tour!', + preferredModalPosition: 'bottom', + hideCurrentStepLabel: true, + }, + { + selector: `#${HomeStepIds.two}`, + content: + "And this is a cool logo. Try scrolling down the page. You'll see an arrow appear. You can click anywhere in this modal to be taken back to the highlighted area.", + }, + { + selector: `#${HomeStepIds.three}`, + content: 'The highlighted area will track moving objects', + track: true, + preferredModalPosition: 'right', + }, + { + selector: `#${HomeStepIds.four}`, + anchorSelector: `#${HomeStepIds.fourContainer}`, + content: + 'The highlighted area will track moving objects, but the modal stays anchored to its container.', + track: true, + }, + { + selector: `#${HomeStepIds.verticalOne}`, + content: 'The highlighted area will track the size of objects which change shape.', + track: true, + }, + { + selector: `#${HomeStepIds.horizontalOne}`, + content: + "The highlighted area will track the size of objects which change shape. Even when it's their width!", + track: true, + }, + { + selector: `#${HomeStepIds.horVertOne}`, + content: 'And when they change in both directions.', + track: true, + }, + { + selector: `#${HomeStepIds.verticalTwo}`, + anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`, + content: 'The highlighted area will track the size of objects which change shape.', + track: true, + }, + { + selector: `#${HomeStepIds.horizontalTwo}`, + anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`, + content: + "The highlighted area will track the size of objects which change shape. Even when it's their width!", + track: true, + }, + { + selector: `#${HomeStepIds.horVertTwo}`, + anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`, + content: 'And when they change in both directions.', + track: true, + }, + { + selector: `#row-1-col-1`, + content: 'I can even handle really wide scrolling content.', + }, + { + selector: `#row-4-col-20`, + content: 'Just like that 😏', + }, + { + selector: `#row-1-col-1`, + content: 'And that 😱', + }, + { + selector: `#${HomeStepIds.prefRight}`, + content: 'I prefer to position this modal on the right', + preferredModalPosition: 'right', + }, + { + selector: `#${HomeStepIds.prefLeft}`, + content: "I prefer to position this modal on the left, but there isn't enough space 😞", + preferredModalPosition: 'left', + }, + { + selector: `#${HomeStepIds.prefTop}`, + content: 'I prefer to position this modal on top', + preferredModalPosition: 'top', + }, + { + selector: `#${HomeStepIds.bye}`, + content: '', + component: Bye, + }, +];