@storybook/nextjs 7.3.2 → 7.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/{index.d-62173427.d.ts → index.d-4cb7d32b.d.ts} +20 -19
- package/dist/preset.d.ts +1 -1
- package/dist/preview.d.ts +1 -1
- package/package.json +11 -10
- package/src/globals.d.ts +0 -3
- package/template/stories/DynamicImport.stories.jsx +0 -20
- package/template/stories/Image.stories.jsx +0 -89
- package/template/stories/StyledJsx.stories.jsx +0 -20
- package/template/stories_nextjs-12-js/ImageFuture.stories.jsx +0 -55
- package/template/stories_nextjs-12-js/Link.stories.jsx +0 -28
- package/template/stories_nextjs-default-js/Font.jsx +0 -64
- package/template/stories_nextjs-default-js/Font.stories.jsx +0 -23
- package/template/stories_nextjs-default-js/Head.stories.jsx +0 -34
- package/template/stories_nextjs-default-js/ImageLegacy.stories.jsx +0 -36
- package/template/stories_nextjs-default-js/Link.stories.jsx +0 -82
- package/template/stories_nextjs-default-js/Link.stories.module.css +0 -3
- package/template/stories_nextjs-default-js/Navigation.stories.jsx +0 -124
- package/template/stories_nextjs-default-js/Router.stories.jsx +0 -69
- package/template/stories_nextjs-default-js/fonts/OFL.txt +0 -93
- package/template/stories_nextjs-default-js/fonts/RubikStorm-Regular.ttf +0 -0
- package/template/stories_nextjs-default-ts/Link.stories.module.css +0 -3
- package/template/stories_nextjs-default-ts/Link.stories.tsx +0 -85
- package/template/stories_nextjs-default-ts/Navigation.stories.tsx +0 -81
package/README.md
CHANGED
|
@@ -827,10 +827,15 @@ Below is an example of how to add svgr support to Storybook with this framework.
|
|
|
827
827
|
export default {
|
|
828
828
|
// ...
|
|
829
829
|
webpackFinal: async (config) => {
|
|
830
|
+
config.module = config.module || {};
|
|
831
|
+
config.module.rules = config.module.rules || [];
|
|
832
|
+
|
|
830
833
|
// This modifies the existing image rule to exclude .svg files
|
|
831
834
|
// since you want to handle those files with @svgr/webpack
|
|
832
|
-
const imageRule = config.module.rules.find((rule) => rule
|
|
833
|
-
imageRule
|
|
835
|
+
const imageRule = config.module.rules.find((rule) => rule?.['test']?.test('.svg'));
|
|
836
|
+
if (imageRule) {
|
|
837
|
+
imageRule['exclude'] = /\.svg$/;
|
|
838
|
+
}
|
|
834
839
|
|
|
835
840
|
// Configure .svg files to be loaded with @svgr/webpack
|
|
836
841
|
config.module.rules.push({
|
|
@@ -850,6 +850,19 @@ type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: T
|
|
|
850
850
|
type StoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
|
|
851
851
|
type DecoratorFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (fn: PartialStoryFn<TRenderer, TArgs>, c: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
852
852
|
|
|
853
|
+
interface Options$1 {
|
|
854
|
+
allowRegExp: boolean;
|
|
855
|
+
allowFunction: boolean;
|
|
856
|
+
allowSymbol: boolean;
|
|
857
|
+
allowDate: boolean;
|
|
858
|
+
allowUndefined: boolean;
|
|
859
|
+
allowClass: boolean;
|
|
860
|
+
allowError: boolean;
|
|
861
|
+
maxDepth: number;
|
|
862
|
+
space: number | undefined;
|
|
863
|
+
lazyEval: boolean;
|
|
864
|
+
}
|
|
865
|
+
|
|
853
866
|
type ExportName = string;
|
|
854
867
|
type MetaId = string;
|
|
855
868
|
interface StoriesSpecifier {
|
|
@@ -962,25 +975,6 @@ type DocsIndexInput = BaseIndexInput & {
|
|
|
962
975
|
storiesImports?: Path[];
|
|
963
976
|
};
|
|
964
977
|
type IndexInput = StoryIndexInput | DocsIndexInput;
|
|
965
|
-
type Addon_ReturnTypeFramework<ReturnType> = {
|
|
966
|
-
component: any;
|
|
967
|
-
storyResult: ReturnType;
|
|
968
|
-
canvasElement: any;
|
|
969
|
-
};
|
|
970
|
-
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
971
|
-
type Path = string;
|
|
972
|
-
|
|
973
|
-
interface Options$1 {
|
|
974
|
-
allowRegExp: boolean;
|
|
975
|
-
allowFunction: boolean;
|
|
976
|
-
allowSymbol: boolean;
|
|
977
|
-
allowDate: boolean;
|
|
978
|
-
allowUndefined: boolean;
|
|
979
|
-
allowClass: boolean;
|
|
980
|
-
maxDepth: number;
|
|
981
|
-
space: number | undefined;
|
|
982
|
-
lazyEval: boolean;
|
|
983
|
-
}
|
|
984
978
|
|
|
985
979
|
/**
|
|
986
980
|
* ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
|
|
@@ -1280,5 +1274,12 @@ interface StorybookConfig {
|
|
|
1280
1274
|
type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
|
|
1281
1275
|
type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
|
|
1282
1276
|
type PresetPropertyFn<K, TStorybookConfig = StorybookConfig, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
|
|
1277
|
+
type Addon_ReturnTypeFramework<ReturnType> = {
|
|
1278
|
+
component: any;
|
|
1279
|
+
storyResult: ReturnType;
|
|
1280
|
+
canvasElement: any;
|
|
1281
|
+
};
|
|
1282
|
+
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
1283
|
+
type Path = string;
|
|
1283
1284
|
|
|
1284
1285
|
export { Addon_DecoratorFunction as A, Options as O, PresetProperty as P };
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PresetProperty, O as Options } from './index.d-
|
|
1
|
+
import { P as PresetProperty, O as Options } from './index.d-4cb7d32b.js';
|
|
2
2
|
import { TransformOptions } from '@babel/core';
|
|
3
3
|
import { StorybookConfig } from './index.js';
|
|
4
4
|
import 'file-system-cache';
|
package/dist/preview.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/nextjs",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0-alpha.1",
|
|
4
4
|
"description": "Storybook for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -48,10 +48,11 @@
|
|
|
48
48
|
"types": "dist/index.d.ts",
|
|
49
49
|
"files": [
|
|
50
50
|
"dist/**/*",
|
|
51
|
-
"template/**/*",
|
|
51
|
+
"template/cli/**/*",
|
|
52
52
|
"README.md",
|
|
53
53
|
"*.js",
|
|
54
|
-
"*.d.ts"
|
|
54
|
+
"*.d.ts",
|
|
55
|
+
"!src/**/*"
|
|
55
56
|
],
|
|
56
57
|
"scripts": {
|
|
57
58
|
"check": "../../../scripts/prepare/check.ts",
|
|
@@ -71,13 +72,13 @@
|
|
|
71
72
|
"@babel/preset-react": "^7.22.5",
|
|
72
73
|
"@babel/preset-typescript": "^7.22.5",
|
|
73
74
|
"@babel/runtime": "^7.22.6",
|
|
74
|
-
"@storybook/addon-actions": "7.
|
|
75
|
-
"@storybook/builder-webpack5": "7.
|
|
76
|
-
"@storybook/core-common": "7.
|
|
77
|
-
"@storybook/node-logger": "7.
|
|
78
|
-
"@storybook/preset-react-webpack": "7.
|
|
79
|
-
"@storybook/preview-api": "7.
|
|
80
|
-
"@storybook/react": "7.
|
|
75
|
+
"@storybook/addon-actions": "7.4.0-alpha.1",
|
|
76
|
+
"@storybook/builder-webpack5": "7.4.0-alpha.1",
|
|
77
|
+
"@storybook/core-common": "7.4.0-alpha.1",
|
|
78
|
+
"@storybook/node-logger": "7.4.0-alpha.1",
|
|
79
|
+
"@storybook/preset-react-webpack": "7.4.0-alpha.1",
|
|
80
|
+
"@storybook/preview-api": "7.4.0-alpha.1",
|
|
81
|
+
"@storybook/react": "7.4.0-alpha.1",
|
|
81
82
|
"@types/node": "^16.0.0",
|
|
82
83
|
"css-loader": "^6.7.3",
|
|
83
84
|
"find-up": "^5.0.0",
|
package/src/globals.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import dynamic from 'next/dynamic';
|
|
2
|
-
import React, { Suspense } from 'react';
|
|
3
|
-
|
|
4
|
-
const DynamicComponent = dynamic(() => import('./dynamic-component'), {
|
|
5
|
-
ssr: false,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
function Component() {
|
|
9
|
-
return (
|
|
10
|
-
<Suspense fallback="Loading...">
|
|
11
|
-
<DynamicComponent />
|
|
12
|
-
</Suspense>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
component: Component,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Default = {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Image from 'next/image';
|
|
3
|
-
import { waitFor } from '@storybook/testing-library';
|
|
4
|
-
|
|
5
|
-
import Accessibility from '../../assets/accessibility.svg';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: Image,
|
|
9
|
-
args: {
|
|
10
|
-
src: Accessibility,
|
|
11
|
-
alt: 'Accessibility',
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const Default = {};
|
|
16
|
-
|
|
17
|
-
export const BlurredPlaceholder = {
|
|
18
|
-
args: {
|
|
19
|
-
placeholder: 'blur',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const BlurredAbsolutePlaceholder = {
|
|
24
|
-
args: {
|
|
25
|
-
src: 'https://storybook.js.org/images/placeholders/50x50.png',
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EWkBq6AAA/HIi62n/Lk67Q7wDYQ0UpQB7hc54T4E6gACLTYxeAwB0YKZL6U4ATEGIBwCs7qPfQJCCHkCnoK50noJKcXcAojsEAJZZKXhgCoziGKxqWV8IMNp4kP2aC+oB0TMFvhGxDQHQfIPhDrilwKOm/YCZASAHfgBABQjr3f7CyAkA0cPB03AQULRhKd4xAIjzHymo2Gp7gN0FAMAVOoA2fPz03a9ssh/RM7Iz8QKIzYF9HyB0XEZ1xJ4DzNoDOAfAslhDDTyjDfv8A2AcBeCiu/jBHQEgxnYW6Kp6BlCVAkQM8VnieF2Xyr0ivXy+XvsCzKOihwNHCCryw8HrQXVB8dgFeRfAVQiXjMbIIgXINQYB2H7Kf5wF/2Ar7h0AgKKGuAP4zOjhzlkLbpcRXKRZhNUjxG6HIQDOjN47gCn4+fWW3xVS9urPESEEwwHMo9IhAGxS2ISiA1iEnQOoA4hXRAwItp7WzL9Ow18ESJaw/ar4NgeOR49cAHCAnaH8swBhv+6CBGjeBSxEOUAI7HyKHkD4O9xKb3/feQouAI4uLBciHRRHmgbfA7h/xFc9AngNBADthvii1sMOiPwDAFeyt6s7FSFS4PmnA1v0vQvqDqQKAAPE/weAUuEgsj8c+H11Twdw/AKANXA82EDr5cJBEEzB3oI4Mb0AdR3nNw8vQnegWuvqAABwJFJEBwDgNdA7IOs3gL0LhuJdwBY8c4BfNnDdVgooHiOqn/b7JoSW/QODjTHXhU7hMQAAAABJRU5ErkJggg==',
|
|
30
|
-
placeholder: 'blur',
|
|
31
|
-
},
|
|
32
|
-
parameters: {
|
|
33
|
-
// ignoring in Chromatic to avoid inconsistent snapshots
|
|
34
|
-
// given that the switch from blur to image is quite fast
|
|
35
|
-
chromatic: { disableSnapshot: true },
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const FilledParent = {
|
|
40
|
-
args: {
|
|
41
|
-
fill: true,
|
|
42
|
-
},
|
|
43
|
-
decorator: [
|
|
44
|
-
(Story) => <div style={{ width: 500, height: 500, position: 'relative' }}>{Story()}</div>,
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Sized = {
|
|
49
|
-
args: {
|
|
50
|
-
fill: true,
|
|
51
|
-
sizes: '(max-width: 600px) 100vw, 600px',
|
|
52
|
-
decorator: [
|
|
53
|
-
(Story) => <div style={{ width: 800, height: 800, position: 'relative' }}>{Story()}</div>,
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const Lazy = {
|
|
59
|
-
args: {
|
|
60
|
-
src: 'https://storybook.js.org/images/placeholders/50x50.png',
|
|
61
|
-
width: 50,
|
|
62
|
-
height: 50,
|
|
63
|
-
},
|
|
64
|
-
parameters: {
|
|
65
|
-
// ignoring in Chromatic to avoid inconsistent snapshots since the image is sometimes not loaded in time
|
|
66
|
-
chromatic: { disableSnapshot: true },
|
|
67
|
-
},
|
|
68
|
-
decorators: [
|
|
69
|
-
(Story) => (
|
|
70
|
-
<>
|
|
71
|
-
<div style={{ height: '200vh' }} />
|
|
72
|
-
{Story()}
|
|
73
|
-
</>
|
|
74
|
-
),
|
|
75
|
-
],
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const Eager = {
|
|
79
|
-
...Lazy,
|
|
80
|
-
parameters: {
|
|
81
|
-
// ignoring in Chromatic to avoid inconsistent snapshots since the image is sometimes not loaded in time
|
|
82
|
-
chromatic: { disableSnapshot: true },
|
|
83
|
-
nextjs: {
|
|
84
|
-
image: {
|
|
85
|
-
loading: 'eager',
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const Component = () => (
|
|
4
|
-
<div>
|
|
5
|
-
<style jsx>{`
|
|
6
|
-
.main p {
|
|
7
|
-
color: #ff4785;
|
|
8
|
-
}
|
|
9
|
-
`}</style>
|
|
10
|
-
<main className="main">
|
|
11
|
-
<p>This is styled using Styled JSX</p>
|
|
12
|
-
</main>
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
component: Component,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Default = {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Image from 'next/future/image';
|
|
3
|
-
|
|
4
|
-
import Accessibility from '../../assets/accessibility.svg';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: Image,
|
|
8
|
-
args: {
|
|
9
|
-
src: Accessibility,
|
|
10
|
-
alt: 'Accessibility',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Default = {};
|
|
15
|
-
|
|
16
|
-
export const BlurredPlaceholder = {
|
|
17
|
-
args: {
|
|
18
|
-
placeholder: 'blur',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const BlurredAbsolutePlaceholder = {
|
|
23
|
-
args: {
|
|
24
|
-
src: 'https://storybook.js.org/images/placeholders/50x50.png',
|
|
25
|
-
width: 50,
|
|
26
|
-
height: 50,
|
|
27
|
-
blurDataURL:
|
|
28
|
-
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABP5JREFUWEeNlwtz2zgMhEGKsv/k9XFp82xe11763yOJVGcXC4m2czM3GYa0E2s/LACSTi+vv1czM/7CvPpqxY/ejPeS3khmFiPHOiVLHKaZi4ux4j18GpMlS6cALupEQBCKQM4BdnGzjIcJgs//QBxAPQAem55f3yL4PWJIdyCyhlMfPdYZot0cwj3Ayg/5JwHA13paen7pADphxr/n5VI8JQsHCCGQ3gVGLLsxQ3h/LYSn5383B05rwNOws3Z576LOTOduvwfrOd5FtVat4akx0uPTrw8BNuUz23vLsY7hmg7i4ipqM2saiAdruNuirh4ff0bNdb3Qy3v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wwHMo9IhAGxS2ISiA1iEnQOoA4hXRAwItp7WzL9Ow18ESJaw/ar4NgeOR49cAHCAnaH8swBhv+6CBGjeBSxEOUAI7HyKHkD4O9xKb3/feQouAI4uLBciHRRHmgbfA7h/xFc9AngNBADthvii1sMOiPwDAFeyt6s7FSFS4PmnA1v0vQvqDqQKAAPE/weAUuEgsj8c+H11Twdw/AKANXA82EDr5cJBEEzB3oI4Mb0AdR3nNw8vQnegWuvqAABwJFJEBwDgNdA7IOs3gL0LhuJdwBY8c4BfNnDdVgooHiOqn/b7JoSW/QODjTHXhU7hMQAAAABJRU5ErkJggg==',
|
|
29
|
-
placeholder: 'blur',
|
|
30
|
-
},
|
|
31
|
-
parameters: {
|
|
32
|
-
// ignoring in Chromatic to avoid inconsistent snapshots
|
|
33
|
-
// given that the switch from blur to image is quite fast
|
|
34
|
-
chromatic: { disableSnapshot: true },
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const FilledParent = {
|
|
39
|
-
args: {
|
|
40
|
-
fill: true,
|
|
41
|
-
},
|
|
42
|
-
decorator: [
|
|
43
|
-
(Story) => <div style={{ width: 500, height: 500, position: 'relative' }}>{Story()}</div>,
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Sized = {
|
|
48
|
-
args: {
|
|
49
|
-
fill: true,
|
|
50
|
-
sizes: '(max-width: 600px) 100vw, 600px',
|
|
51
|
-
decorator: [
|
|
52
|
-
(Story) => <div style={{ width: 800, height: 800, position: 'relative' }}>{Story()}</div>,
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Link from 'next/link';
|
|
3
|
-
|
|
4
|
-
const Component = () => (
|
|
5
|
-
<ul>
|
|
6
|
-
<li>
|
|
7
|
-
<Link href="/">
|
|
8
|
-
<a>Home</a>
|
|
9
|
-
</Link>
|
|
10
|
-
</li>
|
|
11
|
-
<li>
|
|
12
|
-
<Link href="/about">
|
|
13
|
-
<a>About Us</a>
|
|
14
|
-
</Link>
|
|
15
|
-
</li>
|
|
16
|
-
<li>
|
|
17
|
-
<Link href="/blog/hello-world">
|
|
18
|
-
<a>Blog Post</a>
|
|
19
|
-
</Link>
|
|
20
|
-
</li>
|
|
21
|
-
</ul>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
component: Component,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Default = {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
2
|
-
import { Rubik_Puddles } from 'next/font/google';
|
|
3
|
-
import localFont from 'next/font/local';
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
const rubik = Rubik_Puddles({
|
|
8
|
-
subsets: ['latin'],
|
|
9
|
-
variable: '--font-latin-rubik',
|
|
10
|
-
weight: '400',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const localRubikStorm = localFont({
|
|
14
|
-
src: '/fonts/RubikStorm-Regular.ttf',
|
|
15
|
-
variable: '--font-rubik-storm',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export default function Font({ variant }) {
|
|
19
|
-
switch (variant) {
|
|
20
|
-
case 'className':
|
|
21
|
-
return (
|
|
22
|
-
<div>
|
|
23
|
-
<h1 className={rubik.className}>Google Rubik Puddles</h1>
|
|
24
|
-
<h1 className={localRubikStorm.className}>Google Local Rubik Storm</h1>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
case 'style':
|
|
28
|
-
return (
|
|
29
|
-
<div>
|
|
30
|
-
<h1 style={rubik.style}>Google Rubik Puddles</h1>
|
|
31
|
-
<h1 style={localRubikStorm.style}>Google Local Rubik Storm</h1>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
case 'variable':
|
|
35
|
-
return (
|
|
36
|
-
<div>
|
|
37
|
-
<div className={rubik.variable}>
|
|
38
|
-
<h1
|
|
39
|
-
style={{
|
|
40
|
-
fontFamily: 'var(--font-latin-rubik)',
|
|
41
|
-
fontStyle: rubik.style.fontStyle,
|
|
42
|
-
fontWeight: rubik.style.fontWeight,
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
Google Rubik Puddles
|
|
46
|
-
</h1>
|
|
47
|
-
</div>
|
|
48
|
-
<div className={localRubikStorm.variable}>
|
|
49
|
-
<h1
|
|
50
|
-
style={{
|
|
51
|
-
fontFamily: 'var(--font-rubik-storm)',
|
|
52
|
-
fontStyle: localRubikStorm.style.fontStyle,
|
|
53
|
-
fontWeight: localRubikStorm.style.fontWeight,
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
Google Local Rubik Storm
|
|
57
|
-
</h1>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
default:
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Font from './Font';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
component: Font,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const WithClassName = {
|
|
8
|
-
args: {
|
|
9
|
-
variant: 'className',
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const WithStyle = {
|
|
14
|
-
args: {
|
|
15
|
-
variant: 'style',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const WithVariable = {
|
|
20
|
-
args: {
|
|
21
|
-
variant: 'variable',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undef */
|
|
2
|
-
import { expect } from '@storybook/jest';
|
|
3
|
-
import Head from 'next/head';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { within, userEvent, waitFor } from '@storybook/testing-library';
|
|
6
|
-
|
|
7
|
-
function Component() {
|
|
8
|
-
return (
|
|
9
|
-
<div>
|
|
10
|
-
<Head>
|
|
11
|
-
<title>Next.js Head Title</title>
|
|
12
|
-
<meta property="og:title" content="My page title" key="title" />
|
|
13
|
-
</Head>
|
|
14
|
-
<Head>
|
|
15
|
-
<meta property="og:title" content="My new title" key="title" />
|
|
16
|
-
</Head>
|
|
17
|
-
<p>Hello world!</p>
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
component: Component,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Default = {
|
|
27
|
-
play: async ({ canvasElement }) => {
|
|
28
|
-
await waitFor(() => expect(document.title).toEqual('Next.js Head Title'));
|
|
29
|
-
await expect(document.querySelectorAll('meta[property="og:title"]')).toHaveLength(1);
|
|
30
|
-
await expect(document.querySelector('meta[property="og:title"]').content).toEqual(
|
|
31
|
-
'My new title'
|
|
32
|
-
);
|
|
33
|
-
},
|
|
34
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Image from 'next/legacy/image';
|
|
3
|
-
|
|
4
|
-
import Accessibility from '../../assets/accessibility.svg';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: Image,
|
|
8
|
-
args: {
|
|
9
|
-
src: Accessibility,
|
|
10
|
-
alt: 'Accessibility',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Default = {};
|
|
15
|
-
|
|
16
|
-
export const BlurredPlaceholder = {
|
|
17
|
-
args: {
|
|
18
|
-
placeholder: 'blur',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const BlurredAbsolutePlaceholder = {
|
|
23
|
-
args: {
|
|
24
|
-
src: 'https://storybook.js.org/images/placeholders/50x50.png',
|
|
25
|
-
width: 50,
|
|
26
|
-
height: 50,
|
|
27
|
-
blurD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YxeAwB0YKZL6U4ATEGIBwCs7qPfQJCCHkCnoK50noJKcXcAojsEAJZZKXhgCoziGKxqWV8IMNp4kP2aC+oB0TMFvhGxDQHQfIPhDrilwKOm/YCZASAHfgBABQjr3f7CyAkA0cPB03AQULRhKd4xAIjzHymo2Gp7gN0FAMAVOoA2fPz03a9ssh/RM7Iz8QKIzYF9HyB0XEZ1xJ4DzNoDOAfAslhDDTyjDfv8A2AcBeCiu/jBHQEgxnYW6Kp6BlCVAkQM8VnieF2Xyr0ivXy+XvsCzKOihwNHCCryw8HrQXVB8dgFeRfAVQiXjMbIIgXINQYB2H7Kf5wF/2Ar7h0AgKKGuAP4zOjhzlkLbpcRXKRZhNUjxG6HIQDOjN47gCn4+fWW3xVS9urPESEEwwHMo9IhAGxS2ISiA1iEnQOoA4hXRAwItp7WzL9Ow18ESJaw/ar4NgeOR49cAHCAnaH8swBhv+6CBGjeBSxEOUAI7HyKHkD4O9xKb3/feQouAI4uLBciHRRHmgbfA7h/xFc9AngNBADthvii1sMOiPwDAFeyt6s7FSFS4PmnA1v0vQvqDqQKAAPE/weAUuEgsj8c+H11Twdw/AKANXA82EDr5cJBEEzB3oI4Mb0AdR3nNw8vQnegWuvqAABwJFJEBwDgNdA7IOs3gL0LhuJdwBY8c4BfNnDdVgooHiOqn/b7JoSW/QODjTHXhU7hMQAAAABJRU5ErkJggg==',
|
|
29
|
-
placeholder: 'blur',
|
|
30
|
-
},
|
|
31
|
-
parameters: {
|
|
32
|
-
// ignoring in Chromatic to avoid inconsistent snapshots
|
|
33
|
-
// given that the switch from blur to image is quite fast
|
|
34
|
-
chromatic: { disableSnapshot: true },
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Link from 'next/link';
|
|
4
|
-
|
|
5
|
-
import style from './Link.stories.module.css';
|
|
6
|
-
|
|
7
|
-
// `onClick`, `href`, and `ref` need to be passed to the DOM element
|
|
8
|
-
// for proper handling
|
|
9
|
-
const MyButton = React.forwardRef(function Button({ onClick, href, children }, ref) {
|
|
10
|
-
return (
|
|
11
|
-
<a href={href} onClick={onClick} ref={ref}>
|
|
12
|
-
{children}
|
|
13
|
-
</a>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const Component = () => (
|
|
18
|
-
<ul>
|
|
19
|
-
<li>
|
|
20
|
-
<Link href="/">Normal Link</Link>
|
|
21
|
-
</li>
|
|
22
|
-
<li>
|
|
23
|
-
<Link
|
|
24
|
-
href={{
|
|
25
|
-
pathname: '/with-url-object',
|
|
26
|
-
query: { name: 'test' },
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
With URL Object
|
|
30
|
-
</Link>
|
|
31
|
-
</li>
|
|
32
|
-
<li>
|
|
33
|
-
<Link href="/replace-url" replace>
|
|
34
|
-
Replace the URL instead of push
|
|
35
|
-
</Link>
|
|
36
|
-
</li>
|
|
37
|
-
<li>
|
|
38
|
-
<Link href="/legacy-behaviour" legacyBehavior>
|
|
39
|
-
<a>Legacy behavior</a>
|
|
40
|
-
</Link>
|
|
41
|
-
</li>
|
|
42
|
-
<li>
|
|
43
|
-
<Link href="/child-is-functional-component" passHref legacyBehavior>
|
|
44
|
-
<MyButton>child is a functional component</MyButton>
|
|
45
|
-
</Link>
|
|
46
|
-
</li>
|
|
47
|
-
<li>
|
|
48
|
-
<Link href="/#hashid" scroll={false}>
|
|
49
|
-
Disables scrolling to the top
|
|
50
|
-
</Link>
|
|
51
|
-
</li>
|
|
52
|
-
<li>
|
|
53
|
-
<Link href="/no-prefetch" prefetch={false}>
|
|
54
|
-
No Prefetching
|
|
55
|
-
</Link>
|
|
56
|
-
</li>
|
|
57
|
-
<li>
|
|
58
|
-
<Link style={{ color: 'red' }} href="/with-style">
|
|
59
|
-
With style
|
|
60
|
-
</Link>
|
|
61
|
-
</li>
|
|
62
|
-
<li>
|
|
63
|
-
<Link className={style.link} href="/with-classname">
|
|
64
|
-
With className
|
|
65
|
-
</Link>
|
|
66
|
-
</li>
|
|
67
|
-
</ul>
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
component: Component,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const Default = {};
|
|
75
|
-
|
|
76
|
-
export const InAppDir = {
|
|
77
|
-
parameters: {
|
|
78
|
-
nextjs: {
|
|
79
|
-
appDirectory: true,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRouter,
|
|
3
|
-
usePathname,
|
|
4
|
-
useSearchParams,
|
|
5
|
-
useParams,
|
|
6
|
-
useSelectedLayoutSegment,
|
|
7
|
-
useSelectedLayoutSegments,
|
|
8
|
-
} from 'next/navigation';
|
|
9
|
-
import React from 'react';
|
|
10
|
-
|
|
11
|
-
function Component() {
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
const pathname = usePathname();
|
|
14
|
-
const searchParams = useSearchParams();
|
|
15
|
-
const params = useParams();
|
|
16
|
-
const segment = useSelectedLayoutSegment();
|
|
17
|
-
const segments = useSelectedLayoutSegments();
|
|
18
|
-
|
|
19
|
-
const searchParamsList = searchParams ? Array.from(searchParams.entries()) : [];
|
|
20
|
-
|
|
21
|
-
const routerActions = [
|
|
22
|
-
{
|
|
23
|
-
cb: () => router.back(),
|
|
24
|
-
name: 'Go back',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
cb: () => router.forward(),
|
|
28
|
-
name: 'Go forward',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
cb: () => router.prefetch('/prefetched-html'),
|
|
32
|
-
name: 'Prefetch',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
cb: () => router.push('/push-html', { forceOptimisticNavigation: true }),
|
|
36
|
-
name: 'Push HTML',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
cb: () => router.refresh(),
|
|
40
|
-
name: 'Refresh',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
cb: () => router.replace('/replaced-html', { forceOptimisticNavigation: true }),
|
|
44
|
-
name: 'Replace',
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div>
|
|
50
|
-
<div>pathname: {pathname}</div>
|
|
51
|
-
<div>segment: {segment}</div>
|
|
52
|
-
<div>segments: {segments.join(',')}</div>
|
|
53
|
-
<div>
|
|
54
|
-
searchparams:{' '}
|
|
55
|
-
<ul>
|
|
56
|
-
{searchParamsList.map(([key, value]) => (
|
|
57
|
-
<li key={key}>
|
|
58
|
-
{key}: {value}
|
|
59
|
-
</li>
|
|
60
|
-
))}
|
|
61
|
-
</ul>
|
|
62
|
-
</div>
|
|
63
|
-
<div>
|
|
64
|
-
params:{' '}
|
|
65
|
-
<ul>
|
|
66
|
-
{Object.entries(params).map(([key, value]) => (
|
|
67
|
-
<li key={key}>
|
|
68
|
-
{key}: {value}
|
|
69
|
-
</li>
|
|
70
|
-
))}
|
|
71
|
-
</ul>
|
|
72
|
-
</div>
|
|
73
|
-
{routerActions.map(({ cb, name }) => (
|
|
74
|
-
<div key={name} style={{ marginBottom: '1em' }}>
|
|
75
|
-
<button type="button" onClick={cb}>
|
|
76
|
-
{name}
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
))}
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default {
|
|
85
|
-
component: Component,
|
|
86
|
-
parameters: {
|
|
87
|
-
nextjs: {
|
|
88
|
-
appDirectory: true,
|
|
89
|
-
navigation: {
|
|
90
|
-
pathname: '/hello',
|
|
91
|
-
query: {
|
|
92
|
-
foo: 'bar',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const Default = {};
|
|
100
|
-
|
|
101
|
-
export const WithSegmentDefined = {
|
|
102
|
-
parameters: {
|
|
103
|
-
nextjs: {
|
|
104
|
-
appDirectory: true,
|
|
105
|
-
navigation: {
|
|
106
|
-
segments: ['dashboard', 'settings'],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const WithSegmentDefinedForParams = {
|
|
113
|
-
parameters: {
|
|
114
|
-
nextjs: {
|
|
115
|
-
appDirectory: true,
|
|
116
|
-
navigation: {
|
|
117
|
-
segments: [
|
|
118
|
-
['slug', 'hello'],
|
|
119
|
-
['framework', 'nextjs'],
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useRouter } from 'next/router';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
function Component() {
|
|
5
|
-
const router = useRouter();
|
|
6
|
-
const searchParams = router.query;
|
|
7
|
-
|
|
8
|
-
const routerActions = [
|
|
9
|
-
{
|
|
10
|
-
cb: () => router.back(),
|
|
11
|
-
name: 'Go back',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
cb: () => router.forward(),
|
|
15
|
-
name: 'Go forward',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
cb: () => router.prefetch('/prefetched-html'),
|
|
19
|
-
name: 'Prefetch',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
cb: () => router.push('/push-html', { forceOptimisticNavigation: true }),
|
|
23
|
-
name: 'Push HTML',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
cb: () => router.replace('/replaced-html', { forceOptimisticNavigation: true }),
|
|
27
|
-
name: 'Replace',
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div>
|
|
33
|
-
<div>pathname: {router.pathname}</div>
|
|
34
|
-
<div>
|
|
35
|
-
searchparams:{' '}
|
|
36
|
-
<ul>
|
|
37
|
-
{Object.entries(searchParams).map(([key, value]) => (
|
|
38
|
-
<li key={key}>
|
|
39
|
-
{key}: {value}
|
|
40
|
-
</li>
|
|
41
|
-
))}
|
|
42
|
-
</ul>
|
|
43
|
-
</div>
|
|
44
|
-
{routerActions.map(({ cb, name }) => (
|
|
45
|
-
<div key={name} style={{ marginBottom: '1em' }}>
|
|
46
|
-
<button type="button" onClick={cb}>
|
|
47
|
-
{name}
|
|
48
|
-
</button>
|
|
49
|
-
</div>
|
|
50
|
-
))}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
component: Component,
|
|
57
|
-
parameters: {
|
|
58
|
-
nextjs: {
|
|
59
|
-
router: {
|
|
60
|
-
pathname: '/hello',
|
|
61
|
-
query: {
|
|
62
|
-
foo: 'bar',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const Default = {};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
Copyright 2020 The Rubik Filtered Project Authors (https://https://github.com/NaN-xyz/Rubik-Filtered)
|
|
2
|
-
|
|
3
|
-
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
-
This license is copied below, and is also available with a FAQ at:
|
|
5
|
-
http://scripts.sil.org/OFL
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-----------------------------------------------------------
|
|
9
|
-
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
-
-----------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
PREAMBLE
|
|
13
|
-
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
-
development of collaborative font projects, to support the font creation
|
|
15
|
-
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
-
open framework in which fonts may be shared and improved in partnership
|
|
17
|
-
with others.
|
|
18
|
-
|
|
19
|
-
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
-
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
-
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
-
redistributed and/or sold with any software provided that any reserved
|
|
23
|
-
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
-
however, cannot be released under any other type of license. The
|
|
25
|
-
requirement for fonts to remain under this license does not apply
|
|
26
|
-
to any document created using the fonts or their derivatives.
|
|
27
|
-
|
|
28
|
-
DEFINITIONS
|
|
29
|
-
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
-
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
-
include source files, build scripts and documentation.
|
|
32
|
-
|
|
33
|
-
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
-
copyright statement(s).
|
|
35
|
-
|
|
36
|
-
"Original Version" refers to the collection of Font Software components as
|
|
37
|
-
distributed by the Copyright Holder(s).
|
|
38
|
-
|
|
39
|
-
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
-
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
-
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
-
new environment.
|
|
43
|
-
|
|
44
|
-
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
-
writer or other person who contributed to the Font Software.
|
|
46
|
-
|
|
47
|
-
PERMISSION & CONDITIONS
|
|
48
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
-
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
-
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
-
Software, subject to the following conditions:
|
|
52
|
-
|
|
53
|
-
1) Neither the Font Software nor any of its individual components,
|
|
54
|
-
in Original or Modified Versions, may be sold by itself.
|
|
55
|
-
|
|
56
|
-
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
-
redistributed and/or sold with any software, provided that each copy
|
|
58
|
-
contains the above copyright notice and this license. These can be
|
|
59
|
-
included either as stand-alone text files, human-readable headers or
|
|
60
|
-
in the appropriate machine-readable metadata fields within text or
|
|
61
|
-
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
-
|
|
63
|
-
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
-
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
-
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
-
presented to the users.
|
|
67
|
-
|
|
68
|
-
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
-
Software shall not be used to promote, endorse or advertise any
|
|
70
|
-
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
-
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
-
permission.
|
|
73
|
-
|
|
74
|
-
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
-
must be distributed entirely under this license, and must not be
|
|
76
|
-
distributed under any other license. The requirement for fonts to
|
|
77
|
-
remain under this license does not apply to any document created
|
|
78
|
-
using the Font Software.
|
|
79
|
-
|
|
80
|
-
TERMINATION
|
|
81
|
-
This license becomes null and void if any of the above conditions are
|
|
82
|
-
not met.
|
|
83
|
-
|
|
84
|
-
DISCLAIMER
|
|
85
|
-
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
-
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
-
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
-
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
-
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
-
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
-
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Link from 'next/link';
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
|
|
5
|
-
import style from './Link.stories.module.css';
|
|
6
|
-
|
|
7
|
-
// `onClick`, `href`, and `ref` need to be passed to the DOM element
|
|
8
|
-
// for proper handling
|
|
9
|
-
const MyButton = React.forwardRef<
|
|
10
|
-
HTMLAnchorElement,
|
|
11
|
-
React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
|
|
12
|
-
>(function Button({ onClick, href, children }, ref) {
|
|
13
|
-
return (
|
|
14
|
-
<a href={href} onClick={onClick} ref={ref}>
|
|
15
|
-
{children}
|
|
16
|
-
</a>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const Component = () => (
|
|
21
|
-
<ul>
|
|
22
|
-
<li>
|
|
23
|
-
<Link href="/">Normal Link</Link>
|
|
24
|
-
</li>
|
|
25
|
-
<li>
|
|
26
|
-
<Link
|
|
27
|
-
href={{
|
|
28
|
-
pathname: '/with-url-object',
|
|
29
|
-
query: { name: 'test' },
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
With URL Object
|
|
33
|
-
</Link>
|
|
34
|
-
</li>
|
|
35
|
-
<li>
|
|
36
|
-
<Link href="/replace-url" replace>
|
|
37
|
-
Replace the URL instead of push
|
|
38
|
-
</Link>
|
|
39
|
-
</li>
|
|
40
|
-
<li>
|
|
41
|
-
<Link href="/legacy-behaviour" legacyBehavior>
|
|
42
|
-
<a>Legacy behavior</a>
|
|
43
|
-
</Link>
|
|
44
|
-
</li>
|
|
45
|
-
<li>
|
|
46
|
-
<Link href="/child-is-functional-component" passHref legacyBehavior>
|
|
47
|
-
<MyButton>child is a functional component</MyButton>
|
|
48
|
-
</Link>
|
|
49
|
-
</li>
|
|
50
|
-
<li>
|
|
51
|
-
<Link href="/#hashid" scroll={false}>
|
|
52
|
-
Disables scrolling to the top
|
|
53
|
-
</Link>
|
|
54
|
-
</li>
|
|
55
|
-
<li>
|
|
56
|
-
<Link href="/no-prefetch" prefetch={false}>
|
|
57
|
-
No Prefetching
|
|
58
|
-
</Link>
|
|
59
|
-
</li>
|
|
60
|
-
<li>
|
|
61
|
-
<Link style={{ color: 'red' }} href="/with-style">
|
|
62
|
-
With style
|
|
63
|
-
</Link>
|
|
64
|
-
</li>
|
|
65
|
-
<li>
|
|
66
|
-
<Link className={style.link} href="/with-classname">
|
|
67
|
-
With className
|
|
68
|
-
</Link>
|
|
69
|
-
</li>
|
|
70
|
-
</ul>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
export default {
|
|
74
|
-
component: Component,
|
|
75
|
-
} as Meta<typeof Component>;
|
|
76
|
-
|
|
77
|
-
export const Default: StoryObj<typeof Component> = {};
|
|
78
|
-
|
|
79
|
-
export const InAppDir: StoryObj<typeof Component> = {
|
|
80
|
-
parameters: {
|
|
81
|
-
nextjs: {
|
|
82
|
-
appDirectory: true,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// usePathname and useSearchParams are only usable if experimental: {appDir: true} is set in next.config.js
|
|
2
|
-
import { useRouter, usePathname, useSearchParams } from 'next/navigation';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
|
|
6
|
-
function Component() {
|
|
7
|
-
const router = useRouter();
|
|
8
|
-
const pathname = usePathname();
|
|
9
|
-
const searchParams = useSearchParams();
|
|
10
|
-
|
|
11
|
-
const searchParamsList = searchParams ? Array.from(searchParams.entries()) : [];
|
|
12
|
-
|
|
13
|
-
const routerActions = [
|
|
14
|
-
{
|
|
15
|
-
cb: () => router.back(),
|
|
16
|
-
name: 'Go back',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
cb: () => router.forward(),
|
|
20
|
-
name: 'Go forward',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
cb: () => router.prefetch('/prefetched-html'),
|
|
24
|
-
name: 'Prefetch',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// @ts-expect-error (old-api)
|
|
28
|
-
cb: () => router.push('/push-html', { forceOptimisticNavigation: true }),
|
|
29
|
-
name: 'Push HTML',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
cb: () => router.refresh(),
|
|
33
|
-
name: 'Refresh',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
// @ts-expect-error (old-api)
|
|
37
|
-
cb: () => router.replace('/replaced-html', { forceOptimisticNavigation: true }),
|
|
38
|
-
name: 'Replace',
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div>
|
|
44
|
-
<div>pathname: {pathname}</div>
|
|
45
|
-
<div>
|
|
46
|
-
searchparams:{' '}
|
|
47
|
-
<ul>
|
|
48
|
-
{searchParamsList.map(([key, value]) => (
|
|
49
|
-
<li key={key}>
|
|
50
|
-
{key}: {value}
|
|
51
|
-
</li>
|
|
52
|
-
))}
|
|
53
|
-
</ul>
|
|
54
|
-
</div>
|
|
55
|
-
{routerActions.map(({ cb, name }) => (
|
|
56
|
-
<div key={name} style={{ marginBottom: '1em' }}>
|
|
57
|
-
<button type="button" onClick={cb}>
|
|
58
|
-
{name}
|
|
59
|
-
</button>
|
|
60
|
-
</div>
|
|
61
|
-
))}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
component: Component,
|
|
68
|
-
parameters: {
|
|
69
|
-
nextjs: {
|
|
70
|
-
appDirectory: true,
|
|
71
|
-
navigation: {
|
|
72
|
-
pathname: '/hello',
|
|
73
|
-
query: {
|
|
74
|
-
foo: 'bar',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
} as Meta<typeof Component>;
|
|
80
|
-
|
|
81
|
-
export const Default: StoryObj<typeof Component> = {};
|