-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
4,362 additions
and
692 deletions.
There are no files selected for viewing
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
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
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,19 @@ | ||
import type { StorybookConfig } from 'storybook-framework-redwoodjs-vite' | ||
|
||
import { getPaths, importStatementPath } from '@redwoodjs/project-config' | ||
|
||
const redwoodProjectPaths = getPaths() | ||
|
||
const config: StorybookConfig = { | ||
framework: 'storybook-framework-redwoodjs-vite', | ||
|
||
stories: [ | ||
`${importStatementPath( | ||
redwoodProjectPaths.web.src | ||
)}/**/*.stories.@(js|jsx|ts|tsx|mdx)`, | ||
], | ||
|
||
addons: ['@storybook/addon-essentials'], | ||
} | ||
|
||
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 @@ | ||
<div id="redwood-app"></div> |
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,25 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import LoadingBuddy from './LoadingBuddy' | ||
|
||
const meta: Meta<typeof LoadingBuddy> = { | ||
component: LoadingBuddy, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
variant: { | ||
control: { type: 'radio' }, | ||
options: ['primary', 'secondary', 'tertiary'], | ||
}, | ||
}, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof LoadingBuddy> | ||
|
||
/** Test docs */ | ||
export const Primary: Story = { | ||
args: { | ||
className: 'has-text-black', | ||
}, | ||
} |
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,46 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
export type Props = { | ||
className?: string | ||
} | ||
|
||
const apologies = [ | ||
'Just a sec', | ||
'One moment', | ||
'Hang on', | ||
'Hold tight', | ||
'Almost there', | ||
'Just a moment', | ||
] | ||
|
||
const loadingMessages = [ | ||
'reticulating splines', | ||
'refilling the bowl of chips', | ||
'going on a Costco run', | ||
'spiking the punch', | ||
'reversing the polarity', | ||
'looking for the car keys', | ||
'feeding the cat', | ||
'achieving inbox zero', | ||
'finishing that novel', | ||
'looking for the cat', | ||
'petting dogs', | ||
'reading the fine print', | ||
'planning a heist', | ||
'getting the band back together', | ||
] | ||
|
||
function random<T>(choices: T[]): T { | ||
return choices[Math.floor(Math.random() * choices.length)] | ||
} | ||
|
||
const LoadingBuddy = ({ className }: Props) => { | ||
const [message, setMessage] = useState('') | ||
useEffect(() => { | ||
const msg = `${random(apologies)}, ${random(loadingMessages)}...` | ||
setMessage(msg) | ||
}, []) | ||
return <span className={className}>{message}</span> | ||
} | ||
|
||
export default LoadingBuddy |
Oops, something went wrong.