|
| 1 | +export const DefautltAppJs = `import { TourProvider } from '@reactour/tour' |
| 2 | +import { steps } from './steps.js' |
| 3 | +import Main from './Main.js' |
| 4 | + |
| 5 | +export default function App () { |
| 6 | + return ( |
| 7 | + <TourProvider steps={steps}> |
| 8 | + <Main /> |
| 9 | + </TourProvider> |
| 10 | + ) |
| 11 | +} |
| 12 | +` |
| 13 | + |
| 14 | +export const DefaultMainJs = `import { useTour } from '@reactour/tour' |
| 15 | +
|
| 16 | +export default function Main () { |
| 17 | + const { setIsOpen } = useTour() |
| 18 | +
|
| 19 | + return ( |
| 20 | + <div className="demo"> |
| 21 | + <header> |
| 22 | + <button onClick={() => setIsOpen(true)}>Open Tour</button> |
| 23 | + </header> |
| 24 | + <p> |
| 25 | + <span className="first-step">Lorem ipsum</span> dolor sit amet, consectetur adipiscing elit. Praesent at |
| 26 | + finibus nulla, quis varius justo. <span className="second-step">Vestibulum lorem</span> lorem. |
| 27 | + </p> |
| 28 | + <p> |
| 29 | + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed hendrerit enim vel libero sagittis efficitur. Maecenas iaculis metus et magna mollis, sit amet dictum arcu elementum. Vestibulum non turpis at enim aliquet lobortis. Donec vel gravida tellus. Praesent nec tristique velit, at ullamcorper nibh. Suspendisse potenti. Proin ac dolor justo. <span className="third-step">Praesent nisi mauris</span>, eleifend sed iaculis a, tincidunt et tellus. Etiam vitae velit risus. |
| 30 | + </p> |
| 31 | + </div> |
| 32 | + ) |
| 33 | +} |
| 34 | +` |
| 35 | + |
| 36 | +export const defaultStepsjs = `export const steps = [ |
| 37 | + { |
| 38 | + selector: '.first-step', |
| 39 | + content: 'This is the first Step', |
| 40 | + }, |
| 41 | + { |
| 42 | + selector: '.second-step', |
| 43 | + content: 'This is the second Step', |
| 44 | + }, |
| 45 | + { |
| 46 | + selector: '.third-step', |
| 47 | + content: 'This is the third Step', |
| 48 | + }, |
| 49 | + // ... |
| 50 | +] |
| 51 | +` |
| 52 | + |
| 53 | +const stylesCss = ` |
| 54 | +body { |
| 55 | + margin: 0; |
| 56 | + padding: 0; |
| 57 | + font-family: -apple-system, BlinkMacSystemFont, |
| 58 | + 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', |
| 59 | + 'Helvetical Neue', sans-serif; |
| 60 | +} |
| 61 | +.demo { |
| 62 | + padding: 1em; |
| 63 | +} |
| 64 | +.demo header { |
| 65 | + display: flex; |
| 66 | + justify-content: flex-end; |
| 67 | +} |
| 68 | +.demo button { |
| 69 | + border: 0; |
| 70 | + border-radius: 4px; |
| 71 | + color: white; |
| 72 | + padding: .5em 1em; |
| 73 | + font: inherit; |
| 74 | + margin-left: .25em; |
| 75 | + margin-right: .25em; |
| 76 | + background-color: #1c8f9e; |
| 77 | +} |
| 78 | +.demo button:hover { |
| 79 | + opacity: .9; |
| 80 | +} |
| 81 | +.scroll-demo p { |
| 82 | + margin-bottom: 100vh; |
| 83 | +} |
| 84 | +.demo-selectors { |
| 85 | + margin: 0; |
| 86 | + position: fixed; |
| 87 | + bottom: 10px; |
| 88 | + left: 10px; |
| 89 | + background-color: white; |
| 90 | + z-index: 100000; |
| 91 | + padding: 1em; |
| 92 | + box-shadow: 0 0 25px rgba(0,0,0,.1); |
| 93 | +} |
| 94 | +.demo-selectors code { |
| 95 | + display: flex; |
| 96 | +} |
| 97 | +.demo-selectors.column code { |
| 98 | + flex-direction: column |
| 99 | +} |
| 100 | +` |
| 101 | + |
| 102 | +export const defaultFiles = { |
| 103 | + '/App.js': { |
| 104 | + code: DefautltAppJs, |
| 105 | + }, |
| 106 | + '/Main.js': { |
| 107 | + code: DefaultMainJs, |
| 108 | + }, |
| 109 | + '/steps.js': { |
| 110 | + code: defaultStepsjs, |
| 111 | + }, |
| 112 | + '/styles.css': { |
| 113 | + code: stylesCss, |
| 114 | + hidden: true, |
| 115 | + }, |
| 116 | +} |
0 commit comments