diff --git a/package.json b/package.json index 446b104..caff496 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "yarn workspace react-scroll-section build", - "build:watch": "yarn workspace react-scroll-section build --watch", + "build:watch": "yarn workspace react-scroll-section build --watch --minify false", "start": "yarn workspace demo dev", "build:demo": "yarn build && yarn workspace demo build", "release": "yarn build && yarn workspace react-scroll-section release", diff --git a/packages/demo/package.json b/packages/demo/package.json index 40d48f0..890525c 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -11,6 +11,7 @@ "dependencies": { "@types/styled-components": "^5.1.26", "prop-types": "^15.8.1", + "randomcolor": "^0.6.2", "react": "17.0.2", "react-dom": "17.0.2", "react-github-corner": "^2.5.0", @@ -19,6 +20,7 @@ "styled-components": "5.3.6" }, "devDependencies": { + "@types/randomcolor": "^0.5.6", "@types/react": "18.0.21", "@types/react-dom": "18.0.6", "@types/react-toggle": "^4.0.3", diff --git a/packages/demo/src/App.tsx b/packages/demo/src/App.tsx index cd412d6..2ac0a02 100644 --- a/packages/demo/src/App.tsx +++ b/packages/demo/src/App.tsx @@ -1,5 +1,6 @@ import { useState } from 'react'; import { ScrollingProvider, Section } from 'react-scroll-section'; +import randomColor from 'randomcolor'; import ModeToggle, { Mode } from './ModeToggle'; import { DynamicMenu, StaticMenu } from './Menu'; import { Footer, Menu, SectionContainer } from './Builders'; @@ -7,10 +8,21 @@ import logo from './logo.svg'; function App() { const [mode, setMode] = useState('dynamic'); + const [sections, setSections] = useState([]); return ( - {mode === 'static' ? : } + + {mode === 'static' ? ( + + ) : ( + + setSections((prev) => [...prev, `Section ${sections.length + 1}`]) + } + /> + )} +
@@ -22,7 +34,7 @@ function App() {
- + 🙋‍♂️ @@ -30,7 +42,7 @@ function App() {
- + 💻 @@ -38,13 +50,31 @@ function App() {
- + 💌
+ {sections.map((name) => ( +
+ + + {name}{' '} + + setSections((prev) => prev.filter((id) => id !== name)) + } + > + x + + + +
+ ))} +