Skip to content

Commit ea630ae

Browse files
authored
Merge pull request #133 from storacha/fix-account-selectors
fix: Account selects are clearer and sturdier
2 parents 43d4dfe + 3a35c5d commit ea630ae

24 files changed

+759
-781
lines changed

.storybook/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const config: StorybookConfig = {
2727
'@storybook/addon-essentials',
2828
'@storybook/addon-links',
2929
'@storybook/addon-interactions',
30+
'@storybook/addon-designs',
31+
'@storybook/addon-backgrounds',
32+
'storybook-addon-pseudo-states',
3033
'@chromatic-com/storybook',
3134
],
3235
framework: {

.storybook/preview.tsx

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,52 @@
1-
import React from 'react'
2-
import type { Preview } from '@storybook/react'
31
import { NuqsAdapter } from 'nuqs/adapters/next/app'
2+
import React, { CSSProperties } from 'react'
3+
4+
// eslint-disable-next-line import/no-restricted-paths -- This one we need.
45
import { dmMono, dmSans, epilogue } from '../src/app/globalStyle'
56

6-
const withFonts = (Story) => (
7-
<div
8-
className={`${dmSans.className} ${dmSans.variable} ${dmMono.variable} ${epilogue.variable}`}
9-
>
10-
<Story />
11-
</div>
12-
)
7+
import type { Decorator, Preview } from '@storybook/react'
8+
9+
const withFonts: Decorator = (Story) => {
10+
const addFonts = (div: HTMLDivElement | null) => {
11+
if (div) {
12+
div.ownerDocument.documentElement.classList.add(
13+
dmSans.className,
14+
dmSans.variable,
15+
dmMono.variable,
16+
epilogue.variable
17+
)
18+
}
19+
}
20+
return (
21+
<div ref={addFonts}>
22+
<Story />
23+
</div>
24+
)
25+
}
1326

14-
const withNuqs = (Story) => (
27+
const withNuqs: Decorator = (Story) => (
1528
<NuqsAdapter>
1629
<Story />
1730
</NuqsAdapter>
1831
)
1932

33+
declare module '@storybook/react' {
34+
interface Parameters {
35+
parentSize?: {
36+
width?: CSSProperties['width']
37+
}
38+
}
39+
}
40+
41+
const withParentSize: Decorator = (Story, { parameters: { parentSize } }) =>
42+
parentSize ? (
43+
<div style={{ width: parentSize.width }}>
44+
<Story />
45+
</div>
46+
) : (
47+
<Story />
48+
)
49+
2050
const preview: Preview = {
2151
parameters: {
2252
controls: {
@@ -30,7 +60,7 @@ const preview: Preview = {
3060
appDirectory: true,
3161
},
3262
},
33-
decorators: [withFonts, withNuqs],
63+
decorators: [withFonts, withNuqs, withParentSize],
3464
}
3565

3666
export default preview

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,23 @@ const eslintConfig = [
3131
importRecommendedWithoutPlugin,
3232
importPlugin.flatConfigs.typescript,
3333
importPlugin.flatConfigs.react,
34+
{
35+
files: ['**/*.ts', '**/*.tsx', 'src/app/globalStyle.ts'],
36+
languageOptions: {
37+
parserOptions: {
38+
projectService: true,
39+
tsconfigRootDir: import.meta.dirname,
40+
},
41+
},
42+
rules: {
43+
// Disabled until a future PR.
44+
// '@typescript-eslint/no-unnecessary-condition': 'warn'
45+
},
46+
},
3447
{
3548
rules: {
3649
'no-useless-rename': 'warn',
50+
'import/first': 'warn',
3751
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
3852
'import/order': [
3953
'warn',

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
"proper-url-join": "^2.1.2",
6161
"react": "^18.0.0",
6262
"react-aria": "^3.39.0",
63+
"react-aria-components": "^1.8.0",
6364
"react-copy-to-clipboard": "^5.1.0",
6465
"react-dom": "^18.0.0",
6566
"react-hook-form": "^7.54.2",
6667
"react-merge-refs": "^3.0.1",
6768
"react-resizable-panels": "^2.1.7",
6869
"react-responsive": "^10.0.1",
69-
"react-select": "^5.10.1",
7070
"sonner": "^2.0.3",
7171
"swr": "^2.3.3",
7272
"the-new-css-reset": "^1.11.3",
@@ -77,6 +77,8 @@
7777
"@chromatic-com/storybook": "^3.2.5",
7878
"@dotenvx/dotenvx": "^1.40.1",
7979
"@eslint/eslintrc": "^3",
80+
"@storybook/addon-backgrounds": "^8.6.12",
81+
"@storybook/addon-designs": "^8.2.1",
8082
"@storybook/addon-essentials": "8.6.12",
8183
"@storybook/addon-interactions": "^8.6.12",
8284
"@storybook/addon-links": "8.6.12",
@@ -102,6 +104,7 @@
102104
"postgres-shift": "^0.1.0",
103105
"prettier": "^3.5.3",
104106
"storybook": "8.6.12",
107+
"storybook-addon-pseudo-states": "4.0.3",
105108
"style-loader": "^4.0.0",
106109
"typescript": "^5.7.3",
107110
"webpack": "^5.98.0"

0 commit comments

Comments
 (0)