-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addon-onboarding: Move onboarding to monorepo #26176
Merged
Merged
Changes from all commits
Commits
Show all changes
391 commits
Select commit
Hold shift + click to select a range
245de33
Bump version to: 0.0.21 [skip ci]
40ce2c4
improve README
yannbf 004a238
fix query parameter when skipping onboarding
yannbf 35a9153
change the way the addon is triggered, warn user upon completion
yannbf 3f0e1eb
Improved confetti look and feel
cdedreuille 4c88ac0
Merge pull request #43 from storybookjs/fix/improve-confetti
cdedreuille 74f2d86
Merge branch 'main' into feat/misc-fixes
cdedreuille f2bfd23
Update CHANGELOG.md [skip ci]
a4f9388
Bump version to: 0.0.22 [skip ci]
cad9470
Merge pull request #44 from storybookjs/feat/misc-fixes
cdedreuille 2835e60
Update CHANGELOG.md [skip ci]
43491e1
Bump version to: 0.0.23 [skip ci]
e8c20d9
use the correct event to detect args change
yannbf ac7ecc6
Merge pull request #45 from storybookjs/fix/control-toggle-step
yannbf e51e3db
Update CHANGELOG.md [skip ci]
5f27441
Bump version to: 0.0.24 [skip ci]
014c2ee
improve addon bootstrapping
yannbf 9331c8a
Start removing the opening and closing anim on modal
cdedreuille e7cfba6
change last step
yannbf 7f9dcc7
Skip onboarding cleanup
cdedreuille c779e85
fix writeStories story
yannbf 569a919
Merge pull request #46 from storybookjs/fix/improve-addon-bootstrapping
cdedreuille 97e1ac3
Merge branch 'main' into remove-animation-modal
cdedreuille 31de9f1
Update CHANGELOG.md [skip ci]
1395d78
Bump version to: 0.0.25 [skip ci]
69a984a
Fix conflicts
cdedreuille 191af16
Merge pull request #47 from storybookjs/remove-animation-modal
yannbf c142e14
Update CHANGELOG.md [skip ci]
247c877
Bump version to: 0.0.26 [skip ci]
33995a8
add previous button to write stories modal
yannbf e9e2981
Improve Button styling of previous
cdedreuille 5035011
Merge pull request #48 from storybookjs/feat/add-previous-button-to-m…
cdedreuille 98a5602
Update CHANGELOG.md [skip ci]
da2499e
Bump version to: 0.0.27 [skip ci]
56231ae
fix bug where button was out of place
yannbf 5c830ee
improve texts
yannbf 786e8ac
WIP add configure your project layout
yannbf 5900eea
Update Introduction.mdx
cdedreuille bd8e606
Added 3 images
cdedreuille bf4ea29
Update Introduction.mdx
cdedreuille 12818b4
Merge pull request #49 from storybookjs/feat/overall-improvements
cdedreuille 7e6aff1
Update CHANGELOG.md [skip ci]
024ca07
Bump version to: 0.0.28 [skip ci]
7271aac
[skip ci] fix anchor styles
yannbf 4dba997
Merge branch 'main' into valentin/implement-tracking
yannbf 006f101
[skip ci] update copy
yannbf 69103b8
wrap up presets
yannbf 3282e5c
cleanup
yannbf e99afd9
cleanup dependencies
yannbf 7f64975
Update CHANGELOG.md [skip ci]
755bfca
Bump version to: 0.0.29 [skip ci]
e1445ac
[skip ci] cleanup
yannbf 4b3e02d
fix dependencies
yannbf 9cbd35d
switch to pnpm
yannbf db0cd1c
Merge branch 'main' into valentin/implement-tracking
yannbf f8197a1
adjust scripts
yannbf e082a12
fix peer deps
yannbf ce4e7a6
update test instructions
yannbf 9b151a4
Merge pull request #40 from storybookjs/valentin/implement-tracking
yannbf 0b4d759
Update CHANGELOG.md [skip ci]
71379f9
Bump version to: 0.0.30 [skip ci]
b26f2a1
Copy tweaks
shilman cbab81a
Oops
shilman 61fffcd
Merge pull request #50 from storybookjs/shilman/copy-tweaks
yannbf da190f1
Update CHANGELOG.md [skip ci]
f66abbb
Bump version to: 0.0.31 [skip ci]
9a9b85d
Added the missing Story type
cdedreuille 2a73dfa
Fixes the highlighter language
cdedreuille 3a67213
Add missing type for Nextjs
cdedreuille ecf9f9e
Fix some unnecessary outline
cdedreuille 1aab375
Fix syntaxHighlighter moving when initialised
cdedreuille 4d49654
Fix the backdrop moving
cdedreuille 90d99d1
Update SyntaxHighlighter.tsx
cdedreuille 1300d8e
Update SyntaxHighlighter.stories.tsx
cdedreuille 21b3e99
Put path underneath the text
cdedreuille 78f3e71
Update SyntaxHighlighter.stories.tsx
cdedreuille cda7cd6
fix story test
yannbf f943f1f
Merge pull request #51 from storybookjs/fixes-on-syntax-highlighter
yannbf f3cebc0
Update CHANGELOG.md [skip ci]
e0350d8
Bump version to: 0.0.32 [skip ci]
939beb1
misc fixes
yannbf bc0de14
Merge pull request #52 from storybookjs/misc-fixes
yannbf c88ea7a
Update CHANGELOG.md [skip ci]
23e43db
Bump version to: 0.0.33 [skip ci]
015826f
Update Introduction.mdx
cdedreuille 471a550
Merge pull request #53 from storybookjs/fix-configuration-layout
yannbf a851e97
Update CHANGELOG.md [skip ci]
cedfe8e
Bump version to: 0.0.34 [skip ci]
bacbacc
[skip ci] rename Introduction.mdx file
yannbf b09015a
[skip ci] add min-width to section img
yannbf f522dec
add dark mode styles to tooltip
yannbf 3fb8b82
fix watch mode
yannbf 73cda09
Merge pull request #55 from storybookjs/fix/watch-mode
yannbf 9077091
fix button animation
yannbf 8463de1
fix tooltip size
yannbf f640780
Merge pull request #56 from storybookjs/fix/ui-fixes
cdedreuille f80b37a
Merge pull request #54 from storybookjs/feat/dark-mode-tooltip
cdedreuille eecb37c
Update CHANGELOG.md [skip ci]
e844070
Bump version to: 0.0.35 [skip ci]
96a0c60
Fix secondary button background
cdedreuille 6cc1a93
Fixed tooltip colour in dark mode
cdedreuille a5dbb09
fix tooltip in dark mode
yannbf ddefce1
Merge remote-tracking branch 'origin/feat/tooltip-border' into improv…
cdedreuille cc0f34a
Fix some details on dark and light mode
cdedreuille 917f09a
Merge pull request #58 from storybookjs/improve-dark-mode
cdedreuille 997e2e8
Update CHANGELOG.md [skip ci]
e1d0310
Bump version to: 0.0.36 [skip ci]
6769eeb
fix spotlight distance, border radius and overlay border
yannbf 5dcd1f0
Add some small fixes to the highlighter
cdedreuille 60ceb81
Fi the line below the header title
cdedreuille 7bc5014
Small updates
cdedreuille b9a800e
Update WriteStoriesModal.styled.tsx
cdedreuille 32f989c
Merge pull request #61 from storybookjs/fix/more-ui-fixes
cdedreuille 3208c71
Update CHANGELOG.md [skip ci]
d7adb82
Bump version to: 0.0.37 [skip ci]
6768a55
pass addon version in telemetry event
yannbf 272692c
Merge pull request #62 from storybookjs/feat/version-in-events
valentinpalkovic 7a3f2b1
Update CHANGELOG.md [skip ci]
9e827bc
Bump version to: 0.0.38 [skip ci]
616da39
Fix preset.js entry point
valentinpalkovic 6b784e7
Fix comment in code section
valentinpalkovic b540c5d
Merge pull request #64 from storybookjs/fix-comment-in-code-section
valentinpalkovic 5e4810a
Update CHANGELOG.md [skip ci]
3b01870
Bump version to: 0.0.39 [skip ci]
fbb1a1b
Merge branch 'main' into fix-preset-js-entry
valentinpalkovic aadb757
Merge pull request #63 from storybookjs/fix-preset-js-entry
valentinpalkovic d7b2003
Update CHANGELOG.md [skip ci]
b4c57d1
Bump version to: 0.0.40 [skip ci]
405d22d
Minor improvements
valentinpalkovic f481459
Merge pull request #65 from storybookjs/valentin/minor-improvements
valentinpalkovic af45ca4
Update CHANGELOG.md [skip ci]
7b1d89d
Bump version to: 0.0.41 [skip ci]
9e9f0ab
remove unnecessary code step for nextjs
yannbf f14b4ce
update configure mdx
yannbf 6be486a
upgrade storybook deps
yannbf 45e393c
Merge pull request #66 from storybookjs/fix/nextjs-typescript-source
yannbf 320dd0e
Update CHANGELOG.md [skip ci]
4359334
Bump version to: 0.0.42 [skip ci]
7eb8f84
fix links in configure.mdx [skip ci]
yannbf 06a8d19
Merge pull request #67 from storybookjs/fix/mdx-links
yannbf 7a25b91
Fix react joyride in yarn pnp mode
valentinpalkovic d0f4736
Merge pull request #69 from storybookjs/valentin/fix-react-joyride-in…
valentinpalkovic 515fcf0
Update CHANGELOG.md [skip ci]
510cb8a
Bump version to: 0.0.43 [skip ci]
ecf0c58
Fix text for Javascript Projects
valentinpalkovic e66f5c5
Merge branch 'main' into valentin/fix-text-for-javascript-projects
valentinpalkovic 1b5b39c
Merge pull request #68 from storybookjs/valentin/fix-text-for-javascr…
valentinpalkovic 0bab026
[skip ci]: Update README.md
valentinpalkovic 06e37fe
Release 1.0.0
valentinpalkovic d4b3387
Update auto.config.js to reset to default labels
valentinpalkovic 599aed3
Merge pull request #70 from storybookjs/valentin/1.0.0-release
valentinpalkovic 9becc2e
Update CHANGELOG.md [skip ci]
3350d34
Bump version to: 1.0.0 [skip ci]
0e45505
Fix build assets
valentinpalkovic bbe5eb8
Merge pull request #71 from storybookjs/valentin/fix-build-assets
valentinpalkovic 44f3ce1
Update CHANGELOG.md [skip ci]
399fecc
Bump version to: 1.0.1 [skip ci]
37bb3b0
Fix package.json version extraction
valentinpalkovic be7922a
Do not log welcome event twice
valentinpalkovic 940c761
Use fs to read package.json during runtime
valentinpalkovic f943172
Increase timeout on syntaxhighlighter
valentinpalkovic 35f429c
Merge pull request #72 from storybookjs/valentin/fix-package-json-ver…
valentinpalkovic 06786f5
Update CHANGELOG.md [skip ci]
c2d9b6c
Bump version to: 1.0.2 [skip ci]
bb7a9bb
display the button story filename in tooltip
yannbf 7cade1c
fix stories
yannbf 74a44cb
Merge pull request #73 from storybookjs/feat/display-filename-in-tooltip
yannbf dbbc333
Update CHANGELOG.md [skip ci]
7fcc007
Bump version to: 1.0.3 [skip ci]
eb22573
initial styling update for v10
JReinhold aef957a
fix spacing, update assets
JReinhold e7addea
Update copy
JReinhold f237b33
update image alts
JReinhold 557031f
replace chevron with right-arrow
JReinhold 5385a02
Add the addon section
cdedreuille 4af5e6a
Update SyntaxHighlighter.stories.tsx
cdedreuille ad350d6
Fix responsive issues
cdedreuille 85c1178
Update Configure.mdx
cdedreuille 89bbe97
Merge pull request #74 from storybookjs/update-configure-page-styles
cdedreuille 7b88cf3
Update CHANGELOG.md [skip ci]
4e713e3
Bump version to: 1.0.4 [skip ci]
33810e6
remove nextjs-specific code
yannbf c78d3bd
Merge pull request #75 from storybookjs/fix/language-examples
valentinpalkovic ee6e7ab
Update CHANGELOG.md [skip ci]
7276282
Bump version to: 1.0.5 [skip ci]
4f74e6d
Fix language detection
valentinpalkovic 1fa4e72
Merge pull request #76 from storybookjs/valentin/fix-language-detection
valentinpalkovic 5a0156c
Update CHANGELOG.md [skip ci]
78e1108
Bump version to: 1.0.6 [skip ci]
b895661
Replace chevron icon on Configure page to avoid @storybook/components…
valentinpalkovic e286b7d
Merge pull request #77 from storybookjs/valentin/replace-chevron-icon…
valentinpalkovic c5d00e2
Update CHANGELOG.md [skip ci]
1d215c5
Bump version to: 1.0.7 [skip ci]
fc52bf1
Create CODEOWNERS
valentinpalkovic c7d495a
Update CHANGELOG.md [skip ci]
f9003d9
Bump version to: 1.0.8 [skip ci]
a21205b
fix z-index in modal elements
cdedreuille 623d2b2
update step selector
yannbf 91e23d0
update telemetry version
yannbf 3e0df9a
Merge pull request #79 from storybookjs/fix/upgrade-telemetry
yannbf 0dda21a
Update CHANGELOG.md [skip ci]
cafd630
Bump version to: 1.0.9 [skip ci]
e30e708
Fix Yarn remove command in README
githrdw 4b7e5e4
Merge pull request #80 from githrdw/fix/yarn-remove-command
valentinpalkovic acec985
Update CHANGELOG.md [skip ci]
346e139
Bump version to: 1.0.10 [skip ci]
9bdace7
Revert "update step selector"
yannbf 8f95282
Merge pull request #78 from storybookjs/charles/fix-z-index
yannbf dc9d5ea
make selectors storybook 8 compatible
yannbf b82da02
Merge pull request #81 from storybookjs/fix/storybook-8
yannbf 870db45
add z-index wrapper
ndelangen 08ed7fc
Merge pull request #82 from storybookjs/norbert/fix-z-index
yannbf 360b17b
Update CHANGELOG.md [skip ci]
9da85cb
Bump version to: 1.0.11 [skip ci]
dfd1d9c
Add Storybook 8.0 support
4019311
Fix Chromatic GH Action
bbb5f5b
Update Node.js version on CI to 18.x
valentinpalkovic 2e7c31e
Remove duplicate auto config
valentinpalkovic ce99b28
Upgrade dependencies
valentinpalkovic fe09b4b
Fix type issues
valentinpalkovic 047c2ec
Format tsup.config.ts
valentinpalkovic 245bbce
Merge pull request #84 from storybookjs/valentin/add-sb-8-support
valentinpalkovic 35f562f
Replace deprecated Icon component
valentinpalkovic 1c18b81
Merge pull request #85 from storybookjs/valentin/replace-deprecated-i…
valentinpalkovic 6cf3e64
Add esbuild options for handling PNG files
valentinpalkovic 9eec28b
Merge pull request #86 from storybookjs/valentin/fix-image-embedding
valentinpalkovic a2f275a
add script
ndelangen 172497e
delete files not needed for merge
ndelangen db74dd7
move files to nester directory
ndelangen 7f63e60
Merge branch 'norbert/prep-for-merge' of github.com:storybookjs/addon…
ndelangen 5bf7327
remove import-repo script, didn't end up using it
ndelangen ba5cc6c
connect to monorepo & linting fixes
ndelangen 596f3d9
update CLI with new package version
ndelangen 6827ee0
add to root, fix typos
ndelangen bdff5a2
fix react-confetti & add safety catches
ndelangen b2caeba
typescript fixes / workarounds
ndelangen d9bde9d
Merge branch 'next' into monorepo-migration
ndelangen 50c3157
cleanup
ndelangen 25ee02d
remove stories that are unused
ndelangen e72e3b2
Merge branch 'next' into monorepo-migration
ndelangen 67206cd
fixes
ndelangen de94881
bump
ndelangen 58a54fa
arg, that explains it
ndelangen ad9b18a
replace `as any` with slightly less worse code
ndelangen 2c22292
bundle in images into addon entries destined fro the browser
ndelangen 11525f5
remove try-catch as per https://github.com/storybookjs/storybook/pull…
ndelangen 0496de9
Update code/addons/onboarding/src/App.tsx
ndelangen e072ee4
Merge branch 'next' into monorepo-migration
ndelangen 27eaa3f
Update code/addons/onboarding/src/manager.tsx
yannbf e03e42e
Merge branch 'next' into monorepo-migration
ndelangen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Storybook Addon Onboarding | ||
|
||
This addon provides a guided tour in some of Storybook's features, helping you get to know about the basics of Storybook and learn how to write stories! | ||
|
||
![](./.github/assets/onboarding-intro.png) | ||
|
||
## Triggering the onboarding | ||
|
||
This addon comes installed by default in Storybook projects and should trigger automatically. | ||
If you want to retrigger the addon, you should make sure that your Storybook still contains the example stories that come when initializing Storybook, and you can then navigate to http://localhost:6006/?path=/onboarding after running Storybook. | ||
|
||
## Uninstalling | ||
|
||
This addon serves to provide you a guided experience on the basics of Storybook. Once you are done, the addon is therefore not needed anymore and will not get activated (unless triggered manually), so you can freely remove it. Here's how to do so: | ||
|
||
### 1. Remove the dependency | ||
|
||
yarn: | ||
|
||
```zsh | ||
yarn remove @storybook/addon-onboarding | ||
``` | ||
|
||
npm: | ||
|
||
```zsh | ||
npm uninstall -D @storybook/addon-onboarding | ||
``` | ||
|
||
pnpm: | ||
|
||
```zsh | ||
pnpm remove -D @storybook/addon-onboarding | ||
``` | ||
|
||
### 2. Remove the addon in your `.storybook/main.js` file | ||
|
||
```diff | ||
const config = { | ||
stories: [ | ||
"../stories/**/*.stories.mdx", | ||
"../stories/**/*.stories.@(js|jsx|ts|tsx)", | ||
], | ||
addons: [ | ||
"@storybook/addon-essentials", | ||
- "@storybook/addon-onboarding" | ||
], | ||
}; | ||
export default config; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"name": "@storybook/addon-onboarding", | ||
"version": "8.0.0-beta.5", | ||
"description": "Storybook Addon Onboarding - Introduces a new onboarding experience", | ||
"keywords": [ | ||
"storybook-addons", | ||
"addon-onboarding" | ||
], | ||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/addons/onboarding", | ||
"bugs": { | ||
"url": "https://github.com/storybookjs/storybook/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/storybookjs/storybook.git", | ||
"directory": "code/addons/onboarding" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/storybook" | ||
}, | ||
"license": "MIT", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"node": "./dist/index.js", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
}, | ||
"./manager": "./dist/manager.js", | ||
"./preset": "./dist/preset.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*", | ||
"README.md", | ||
"*.js", | ||
"*.d.ts", | ||
"!src/**/*" | ||
], | ||
"scripts": { | ||
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", | ||
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" | ||
}, | ||
"devDependencies": { | ||
"@radix-ui/react-dialog": "^1.0.5", | ||
"@storybook/channels": "workspace:*", | ||
"@storybook/components": "workspace:*", | ||
"@storybook/core-events": "workspace:*", | ||
"@storybook/icons": "^1.2.5", | ||
"@storybook/manager-api": "workspace:*", | ||
"@storybook/react": "workspace:*", | ||
"@storybook/telemetry": "workspace:*", | ||
"@storybook/test": "workspace:*", | ||
"@storybook/testing-library": "next", | ||
"@storybook/theming": "workspace:*", | ||
"@storybook/types": "workspace:*", | ||
"framer-motion": "^11.0.3", | ||
"react": "^18.2.0", | ||
"react-confetti": "^6.1.0", | ||
"react-dom": "^18.2.0", | ||
"react-joyride": "^2.7.2", | ||
"react-use-measure": "^2.1.1", | ||
"typescript": "^5.3.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"bundler": { | ||
"exportEntries": [ | ||
"./src/index.ts" | ||
], | ||
"managerEntries": [ | ||
"./src/manager.tsx" | ||
], | ||
"nodeEntries": [ | ||
"./src/preset.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function managerEntries(entry = []) { | ||
return [...entry, require.resolve('./dist/manager.mjs')]; | ||
} | ||
|
||
module.exports = { | ||
managerEntries, | ||
...require('./dist/preset'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@storybook/addon-onboarding", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"implicitDependencies": [], | ||
"type": "library" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import { ThemeProvider, convert } from '@storybook/theming'; | ||
import { addons, type API } from '@storybook/manager-api'; | ||
|
||
import { GuidedTour } from './features/GuidedTour/GuidedTour'; | ||
import { WelcomeModal } from './features/WelcomeModal/WelcomeModal'; | ||
import { WriteStoriesModal } from './features/WriteStoriesModal/WriteStoriesModal'; | ||
import { Confetti } from './components/Confetti/Confetti'; | ||
import { STORYBOOK_ADDON_ONBOARDING_CHANNEL } from './constants'; | ||
import { useGetProject } from './features/WriteStoriesModal/hooks/useGetProject'; | ||
|
||
type Step = | ||
| '1:Welcome' | ||
| '2:StorybookTour' | ||
| '3:WriteYourStory' | ||
| '4:VisitNewStory' | ||
| '5:ConfigureYourProject'; | ||
|
||
const theme = convert(); | ||
|
||
export default function App({ api }: { api: API }) { | ||
const [enabled, setEnabled] = useState(true); | ||
const [showConfetti, setShowConfetti] = useState(false); | ||
const [step, setStep] = useState<Step>('1:Welcome'); | ||
const { data: codeSnippets } = useGetProject(); | ||
|
||
const skipOnboarding = useCallback(() => { | ||
// remove onboarding query parameter from current url | ||
const url = new URL(window.location.href); | ||
// @ts-expect-error (not strict) | ||
const path = decodeURIComponent(url.searchParams.get('path')); | ||
url.search = `?path=${path}&onboarding=false`; | ||
history.replaceState({}, '', url.href); | ||
api.setQueryParams({ onboarding: 'false' }); | ||
setEnabled(false); | ||
}, [setEnabled, api]); | ||
|
||
useEffect(() => { | ||
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, { | ||
step: '1:Welcome', | ||
type: 'telemetry', | ||
}); | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (step !== '1:Welcome') { | ||
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, { | ||
step, | ||
type: 'telemetry', | ||
}); | ||
} | ||
}, [api, step]); | ||
|
||
useEffect(() => { | ||
let stepTimeout: number; | ||
if (step === '4:VisitNewStory') { | ||
setShowConfetti(true); | ||
stepTimeout = window.setTimeout(() => { | ||
setStep('5:ConfigureYourProject'); | ||
}, 2000); | ||
} | ||
|
||
return () => { | ||
clearTimeout(stepTimeout); | ||
}; | ||
}, [step]); | ||
|
||
useEffect(() => { | ||
const storyId = api.getCurrentStoryData()?.id; | ||
api.setQueryParams({ onboarding: 'true' }); | ||
// make sure the initial state is set correctly: | ||
// 1. Selected story is primary button | ||
// 2. The addon panel is opened, in the bottom and the controls tab is selected | ||
if (storyId !== 'example-button--primary') { | ||
try { | ||
api.selectStory('example-button--primary', undefined, { | ||
ref: undefined, | ||
}); | ||
} catch (e) { | ||
// | ||
} | ||
} | ||
}, []); | ||
|
||
if (!enabled) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ThemeProvider theme={theme}> | ||
{enabled && showConfetti && ( | ||
<Confetti | ||
numberOfPieces={800} | ||
recycle={false} | ||
tweenDuration={20000} | ||
onConfettiComplete={(confetti) => { | ||
confetti?.reset(); | ||
setShowConfetti(false); | ||
}} | ||
/> | ||
)} | ||
{enabled && step === '1:Welcome' && ( | ||
<WelcomeModal | ||
onProceed={() => { | ||
setStep('2:StorybookTour'); | ||
}} | ||
skipOnboarding={() => { | ||
skipOnboarding(); | ||
|
||
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, { | ||
step: 'X:SkippedOnboarding', | ||
where: 'WelcomeModal', | ||
type: 'telemetry', | ||
}); | ||
}} | ||
/> | ||
)} | ||
{enabled && (step === '2:StorybookTour' || step === '5:ConfigureYourProject') && ( | ||
<GuidedTour | ||
api={api} | ||
isFinalStep={step === '5:ConfigureYourProject'} | ||
onFirstTourDone={() => { | ||
setStep('3:WriteYourStory'); | ||
}} | ||
codeSnippets={codeSnippets || undefined} | ||
onLastTourDone={() => { | ||
try { | ||
api.selectStory('configure-your-project--docs'); | ||
} catch (e) { | ||
// | ||
} | ||
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, { | ||
step: '6:FinishedOnboarding', | ||
type: 'telemetry', | ||
}); | ||
skipOnboarding(); | ||
}} | ||
/> | ||
)} | ||
{enabled && step === '3:WriteYourStory' && codeSnippets && ( | ||
<WriteStoriesModal | ||
api={api} | ||
codeSnippets={codeSnippets} | ||
addonsStore={addons} | ||
onFinish={() => { | ||
api.selectStory('example-button--warning'); | ||
|
||
setStep('4:VisitNewStory'); | ||
}} | ||
skipOnboarding={skipOnboarding} | ||
/> | ||
)} | ||
</ThemeProvider> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
code/addons/onboarding/src/components/Button/Button.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Button } from './Button'; | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: 'Components/Button', | ||
component: Button, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Default: Story = { | ||
args: { children: 'Button' }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React, { forwardRef } from 'react'; | ||
import { styled } from '@storybook/theming'; | ||
|
||
export interface ButtonProps extends ComponentProps<'button'> { | ||
children: string; | ||
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void; | ||
variant?: 'primary' | 'secondary' | 'outline'; | ||
} | ||
|
||
const StyledButton = styled.button<{ variant: ButtonProps['variant'] }>` | ||
all: unset; | ||
box-sizing: border-box; | ||
border: 0; | ||
border-radius: 0.25rem; | ||
cursor: pointer; | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 0 0.75rem; | ||
background: ${({ theme, variant }) => { | ||
if (variant === 'primary') return theme.color.secondary; | ||
if (variant === 'secondary') return theme.color.lighter; | ||
if (variant === 'outline') return 'transparent'; | ||
return theme.color.secondary; | ||
}}; | ||
color: ${({ theme, variant }) => { | ||
if (variant === 'primary') return theme.color.lightest; | ||
if (variant === 'secondary') return theme.darkest; | ||
if (variant === 'outline') return theme.darkest; | ||
return theme.color.lightest; | ||
}}; | ||
box-shadow: ${({ variant }) => { | ||
if (variant === 'primary') return 'none'; | ||
if (variant === 'secondary') return '#D9E8F2 0 0 0 1px inset'; | ||
if (variant === 'outline') return '#D9E8F2 0 0 0 1px inset'; | ||
return 'none'; | ||
}}; | ||
height: 32px; | ||
font-size: 0.8125rem; | ||
font-weight: 700; | ||
font-family: ${({ theme }) => theme.typography.fonts.base}; | ||
transition: background-color, box-shadow, opacity; | ||
transition-duration: 0.16s; | ||
transition-timing-function: ease-in-out; | ||
text-decoration: none; | ||
&:hover { | ||
background-color: ${({ variant }) => { | ||
if (variant === 'primary') return '#0b94eb'; | ||
if (variant === 'secondary') return '#eef4f9'; | ||
if (variant === 'outline') return 'transparent'; | ||
return '#0b94eb'; | ||
}}; | ||
} | ||
&:focus { | ||
box-shadow: ${({ variant }) => { | ||
if (variant === 'primary') return 'inset 0 0 0 1px rgba(0, 0, 0, 0.2)'; | ||
if (variant === 'secondary') return 'inset 0 0 0 1px #0b94eb'; | ||
if (variant === 'outline') return 'inset 0 0 0 1px #0b94eb'; | ||
return 'inset 0 0 0 2px rgba(0, 0, 0, 0.1)'; | ||
}}; | ||
} | ||
`; | ||
|
||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button( | ||
{ children, onClick, variant = 'primary', ...rest }, | ||
ref | ||
) { | ||
return ( | ||
<StyledButton ref={ref} onClick={onClick} variant={variant} {...rest}> | ||
{children} | ||
</StyledButton> | ||
); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this PR is just porting over the existing code, but any idea why this is needed? If there is a good reason we should add a comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea.
We'd have to ask the authors @yannbf or @valentinpalkovic ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilman Could you please be a bit more precise about what exactly you are referring to? Are you saying that the managerEntries should just be exported in the
src/preset.ts
file like described here: https://storybook.js.org/docs/addons/writing-presets#root-level-presets? I don't understand the intention of your question.