@ornikar/bumper 2.7.2-canary.1768566928.e85c568dc49c9180e37b7aec8792b1e8d45968a6.0 → 2.8.0
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/CHANGELOG.md +4 -4
- package/CLAUDE.md +45 -0
- package/dist/definitions/system/core/breakpoints/hooks/useCurrentBreakpointName.d.ts +1 -1
- package/dist/definitions/system/core/breakpoints/hooks/useCurrentBreakpointName.d.ts.map +1 -1
- package/dist/definitions/system/core/breakpoints/utils/breakpointsUtils.d.ts +1 -1
- package/dist/definitions/system/core/breakpoints/utils/breakpointsUtils.d.ts.map +1 -1
- package/dist/definitions/system/core/primitives/Pressable.d.ts +0 -9
- package/dist/definitions/system/core/primitives/Pressable.d.ts.map +1 -1
- package/dist/definitions/system/core/{breakpoints/constants.d.ts → tokens/breakpoints.d.ts} +1 -1
- package/dist/definitions/system/core/tokens/breakpoints.d.ts.map +1 -0
- package/dist/definitions/tamagui.config.d.ts +2 -28
- package/dist/definitions/tamagui.config.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +42 -26
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +42 -26
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +42 -26
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +42 -26
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +42 -26
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +42 -26
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +36 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +36 -20
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/system/content/typography/Typography.features.stories.tsx +156 -0
- package/src/system/content/typography/Typography.stories.tsx +72 -166
- package/src/system/content/typography/__snapshots__/Typography.features.stories.tsx.snap +826 -0
- package/src/system/content/typography/__snapshots__/Typography.stories.tsx.snap +10 -1990
- package/src/system/content/typography/__snapshots_web__/Typography.features.stories.tsx.snap +501 -0
- package/src/system/content/typography/__snapshots_web__/Typography.stories.tsx.snap +7 -808
- package/src/system/core/breakpoints/hooks/useBreakpointValue.test.ts +1 -1
- package/src/system/core/breakpoints/hooks/useCurrentBreakpointName.test.ts +1 -1
- package/src/system/core/breakpoints/hooks/useCurrentBreakpointName.ts +1 -1
- package/src/system/core/breakpoints/utils/breakpointsUtils.test.ts +1 -1
- package/src/system/core/breakpoints/utils/breakpointsUtils.ts +1 -1
- package/src/system/core/primitives/Center.features.stories.tsx +63 -0
- package/src/system/core/primitives/Center.stories.tsx +111 -12
- package/src/system/core/primitives/Pressable.features.stories.tsx +171 -0
- package/src/system/core/primitives/Pressable.stories.tsx +82 -20
- package/src/system/core/primitives/Pressable.tsx +0 -9
- package/src/system/core/primitives/Stack.features.stories.tsx +179 -0
- package/src/system/core/primitives/Stack.stories.tsx +74 -44
- package/src/system/core/primitives/View.features.stories.tsx +452 -0
- package/src/system/core/primitives/View.stories.tsx +122 -9
- package/src/system/core/primitives/__snapshots__/Center.features.stories.tsx.snap +208 -0
- package/src/system/core/primitives/__snapshots__/Center.stories.tsx.snap +13 -8
- package/src/system/core/primitives/__snapshots__/Pressable.features.stories.tsx.snap +470 -0
- package/src/system/core/primitives/__snapshots__/Pressable.stories.tsx.snap +11 -10
- package/src/system/core/primitives/__snapshots__/Stack.features.stories.tsx.snap +1234 -0
- package/src/system/core/primitives/__snapshots__/Stack.stories.tsx.snap +63 -84
- package/src/system/core/primitives/__snapshots__/View.features.stories.tsx.snap +2338 -0
- package/src/system/core/primitives/__snapshots__/View.stories.tsx.snap +6 -4
- package/src/system/core/primitives/__snapshots_web__/Center.features.stories.tsx.snap +107 -0
- package/src/system/core/primitives/__snapshots_web__/Center.stories.tsx.snap +9 -6
- package/src/system/core/primitives/__snapshots_web__/Pressable.features.stories.tsx.snap +193 -0
- package/src/system/core/primitives/__snapshots_web__/Pressable.stories.tsx.snap +5 -5
- package/src/system/core/primitives/__snapshots_web__/Stack.features.stories.tsx.snap +515 -0
- package/src/system/core/primitives/__snapshots_web__/Stack.stories.tsx.snap +30 -22
- package/src/system/core/primitives/__snapshots_web__/View.features.stories.tsx.snap +941 -0
- package/src/system/core/primitives/__snapshots_web__/View.stories.tsx.snap +3 -3
- package/src/system/core/themes/__snapshots__/light.stories.tsx.snap +3822 -2233
- package/src/system/core/themes/__snapshots_web__/light.stories.tsx.snap +1244 -992
- package/src/system/core/themes/light.stories.tsx +61 -28
- package/src/system/core/tokens/__snapshots__/breakpoints.stories.tsx.snap +423 -0
- package/src/system/core/tokens/__snapshots__/fonts.stories.tsx.snap +1635 -0
- package/src/system/core/tokens/__snapshots__/radius.stories.tsx.snap +383 -0
- package/src/system/core/tokens/__snapshots__/size.stories.tsx.snap +864 -0
- package/src/system/core/tokens/__snapshots__/space.stories.tsx.snap +945 -0
- package/src/system/core/tokens/__snapshots_web__/breakpoints.stories.tsx.snap +194 -0
- package/src/system/core/tokens/__snapshots_web__/fonts.stories.tsx.snap +729 -0
- package/src/system/core/tokens/__snapshots_web__/radius.stories.tsx.snap +174 -0
- package/src/system/core/tokens/__snapshots_web__/size.stories.tsx.snap +363 -0
- package/src/system/core/tokens/__snapshots_web__/space.stories.tsx.snap +396 -0
- package/src/system/core/tokens/breakpoints.stories.tsx +46 -0
- package/src/system/core/tokens/fonts.stories.tsx +39 -0
- package/src/system/core/tokens/palettes/__snapshots__/deepPurpleColorPalette.stories.tsx.snap +4337 -2747
- package/src/system/core/tokens/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +1525 -1257
- package/src/system/core/tokens/palettes/deepPurpleColorPalette.stories.tsx +42 -28
- package/src/system/core/tokens/radius.stories.tsx +39 -0
- package/src/system/core/tokens/size.stories.tsx +39 -0
- package/src/system/core/tokens/space.stories.tsx +40 -0
- package/src/tamagui.config.ts +3 -3
- package/dist/definitions/system/core/breakpoints/constants.d.ts.map +0 -1
- package/src/system/core/breakpoints/__snapshots__/breakpoints.stories.tsx.snap +0 -49
- package/src/system/core/breakpoints/__snapshots_web__/breakpoints.stories.tsx.snap +0 -43
- package/src/system/core/breakpoints/breakpoints.stories.tsx +0 -45
- /package/src/system/core/{breakpoints/constants.ts → tokens/breakpoints.ts} +0 -0
|
@@ -1,37 +1,51 @@
|
|
|
1
|
-
import type { Meta,
|
|
2
|
-
import type { GetThemeValueForKey } from '@tamagui/core';
|
|
3
|
-
import { StorySection } from '../../../../shared/storybook/StorySection';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
2
|
import { Typography } from '../../../content/typography/Typography';
|
|
3
|
+
import { HStack, VStack } from '../../primitives/Stack';
|
|
4
|
+
import type { ViewProps } from '../../primitives/View';
|
|
5
5
|
import { View } from '../../primitives/View';
|
|
6
6
|
import { deepPurpleColorPalette } from './deepPurpleColorPalette';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
title: 'bumper/Core Tokens',
|
|
10
|
-
component: View,
|
|
11
|
-
} satisfies Meta<typeof View>;
|
|
12
|
-
|
|
13
|
-
const TokenView = ({ tokenName, tokenValue }: { tokenName: string; tokenValue: string }) => {
|
|
8
|
+
const ColorSwatchRow = ({ tokenName, colorValue }: { tokenName: string; colorValue: string }): React.ReactNode => {
|
|
14
9
|
return (
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<View
|
|
25
|
-
|
|
10
|
+
<HStack gap="$space.16" alignItems="center">
|
|
11
|
+
<View
|
|
12
|
+
width="$size.48"
|
|
13
|
+
height="$size.48"
|
|
14
|
+
borderRadius="$radius.m"
|
|
15
|
+
backgroundColor={colorValue as ViewProps['backgroundColor']}
|
|
16
|
+
borderWidth={1}
|
|
17
|
+
borderColor="$border.base.low"
|
|
18
|
+
/>
|
|
19
|
+
<View width={200}>
|
|
20
|
+
<Typography.Text variant="body-s" weight="bold">
|
|
21
|
+
${tokenName}
|
|
22
|
+
</Typography.Text>
|
|
23
|
+
</View>
|
|
24
|
+
<Typography.Text variant="body-s" color="$content.base.mid">
|
|
25
|
+
{colorValue}
|
|
26
|
+
</Typography.Text>
|
|
27
|
+
</HStack>
|
|
26
28
|
);
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
31
|
+
const meta: Meta = {
|
|
32
|
+
title: 'Bumper/Core/Tokens',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
export const ColorPalette: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<VStack gap="$space.24">
|
|
41
|
+
<Typography.Text variant="body-m" color="$content.base.mid">
|
|
42
|
+
The complete color palette tokens available in the design system.
|
|
43
|
+
</Typography.Text>
|
|
44
|
+
<VStack gap="$space.8">
|
|
45
|
+
{Object.entries(deepPurpleColorPalette).map(([tokenName, colorValue]) => (
|
|
46
|
+
<ColorSwatchRow key={tokenName} tokenName={tokenName} colorValue={colorValue} />
|
|
47
|
+
))}
|
|
48
|
+
</VStack>
|
|
49
|
+
</VStack>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Typography } from '../../content/typography/Typography';
|
|
3
|
+
import { HStack, VStack } from '../primitives/Stack';
|
|
4
|
+
import { View } from '../primitives/View';
|
|
5
|
+
import { radiusTokens } from './radius';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Bumper/Core/Tokens',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Radius: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<VStack gap="$space.24">
|
|
17
|
+
<Typography.Text variant="body-m" color="$content.base.mid">
|
|
18
|
+
Radius tokens define consistent border-radius values for rounded corners.
|
|
19
|
+
</Typography.Text>
|
|
20
|
+
<VStack gap="$space.8">
|
|
21
|
+
{Object.entries(radiusTokens).map(([tokenName, value]) => (
|
|
22
|
+
<HStack key={tokenName} gap="$space.16" alignItems="center">
|
|
23
|
+
<View width={150}>
|
|
24
|
+
<Typography.Text variant="body-s" weight="bold">
|
|
25
|
+
${tokenName}
|
|
26
|
+
</Typography.Text>
|
|
27
|
+
</View>
|
|
28
|
+
<View width={80}>
|
|
29
|
+
<Typography.Text variant="body-s" color="$content.base.mid">
|
|
30
|
+
{value === 1000 ? 'circle' : `${value}px`}
|
|
31
|
+
</Typography.Text>
|
|
32
|
+
</View>
|
|
33
|
+
<View backgroundColor="$bg.accent.default" width="$size.64" height="$size.64" borderRadius={value} />
|
|
34
|
+
</HStack>
|
|
35
|
+
))}
|
|
36
|
+
</VStack>
|
|
37
|
+
</VStack>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Typography } from '../../content/typography/Typography';
|
|
3
|
+
import { HStack, VStack } from '../primitives/Stack';
|
|
4
|
+
import { View } from '../primitives/View';
|
|
5
|
+
import { sizeTokens } from './size';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Bumper/Core/Tokens',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Size: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<VStack gap="$space.24">
|
|
17
|
+
<Typography.Text variant="body-m" color="$content.base.mid">
|
|
18
|
+
Size tokens define consistent dimension values used for width and height properties.
|
|
19
|
+
</Typography.Text>
|
|
20
|
+
<VStack gap="$space.8">
|
|
21
|
+
{Object.entries(sizeTokens).map(([tokenName, value]) => (
|
|
22
|
+
<HStack key={tokenName} gap="$space.16" alignItems="center">
|
|
23
|
+
<View width={150}>
|
|
24
|
+
<Typography.Text variant="body-s" weight="bold">
|
|
25
|
+
${tokenName}
|
|
26
|
+
</Typography.Text>
|
|
27
|
+
</View>
|
|
28
|
+
<View width={60}>
|
|
29
|
+
<Typography.Text variant="body-s" color="$content.base.mid">
|
|
30
|
+
{value}px
|
|
31
|
+
</Typography.Text>
|
|
32
|
+
</View>
|
|
33
|
+
<View backgroundColor="$bg.accent.default" height="$size.24" width={value} borderRadius="$radius.s" />
|
|
34
|
+
</HStack>
|
|
35
|
+
))}
|
|
36
|
+
</VStack>
|
|
37
|
+
</VStack>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Typography } from '../../content/typography/Typography';
|
|
3
|
+
import { HStack, VStack } from '../primitives/Stack';
|
|
4
|
+
import { View } from '../primitives/View';
|
|
5
|
+
import { spaceTokens } from './space';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Bumper/Core/Tokens',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Space: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<VStack gap="$space.24">
|
|
17
|
+
<Typography.Text variant="heading-l">Space Tokens</Typography.Text>
|
|
18
|
+
<Typography.Text variant="body-m" color="$content.base.mid">
|
|
19
|
+
Space tokens define consistent spacing values used for padding, margin, and gap properties.
|
|
20
|
+
</Typography.Text>
|
|
21
|
+
<VStack gap="$space.8">
|
|
22
|
+
{Object.entries(spaceTokens).map(([tokenName, value]) => (
|
|
23
|
+
<HStack key={tokenName} gap="$space.16" alignItems="center">
|
|
24
|
+
<View width={150}>
|
|
25
|
+
<Typography.Text variant="body-s" weight="bold">
|
|
26
|
+
${tokenName}
|
|
27
|
+
</Typography.Text>
|
|
28
|
+
</View>
|
|
29
|
+
<View width={60}>
|
|
30
|
+
<Typography.Text variant="body-s" color="$content.base.mid">
|
|
31
|
+
{value}px
|
|
32
|
+
</Typography.Text>
|
|
33
|
+
</View>
|
|
34
|
+
<View backgroundColor="$bg.accent.default" height="$size.24" width={value} borderRadius="$radius.s" />
|
|
35
|
+
</HStack>
|
|
36
|
+
))}
|
|
37
|
+
</VStack>
|
|
38
|
+
</VStack>
|
|
39
|
+
),
|
|
40
|
+
};
|
package/src/tamagui.config.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createFont, createTamagui, createTokens } from '@tamagui/core';
|
|
2
|
-
import { BreakpointNameEnum, breakpoints } from './system/core/breakpoints/constants';
|
|
3
2
|
import { light } from './system/core/themes/light';
|
|
4
|
-
import {
|
|
3
|
+
import { BreakpointNameEnum, breakpoints } from './system/core/tokens/breakpoints';
|
|
4
|
+
import { GTStandardFaces, letterSpacing, lineHeight, size, weight } from './system/core/tokens/fonts';
|
|
5
5
|
import { radiusTokens } from './system/core/tokens/radius';
|
|
6
6
|
import { sizeTokens } from './system/core/tokens/size';
|
|
7
7
|
import { spaceTokens } from './system/core/tokens/space';
|
|
8
8
|
|
|
9
9
|
export const fonts = createFont({
|
|
10
10
|
family: 'GTStandard',
|
|
11
|
-
size
|
|
11
|
+
size,
|
|
12
12
|
lineHeight,
|
|
13
13
|
letterSpacing,
|
|
14
14
|
weight,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/system/core/breakpoints/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`bumper/utils/Breakpoints Breakpoints 1`] = `
|
|
4
|
-
<RNCSafeAreaProvider
|
|
5
|
-
onInsetsChange={[Function]}
|
|
6
|
-
style={
|
|
7
|
-
[
|
|
8
|
-
{
|
|
9
|
-
"flex": 1,
|
|
10
|
-
},
|
|
11
|
-
undefined,
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
>
|
|
15
|
-
<Text
|
|
16
|
-
style={
|
|
17
|
-
{
|
|
18
|
-
"fontFamily": "GTStandard",
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
suppressHighlighting={true}
|
|
22
|
-
>
|
|
23
|
-
Current breakpoint name:
|
|
24
|
-
small
|
|
25
|
-
</Text>
|
|
26
|
-
<Text
|
|
27
|
-
style={
|
|
28
|
-
{
|
|
29
|
-
"fontFamily": "GTStandard",
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
suppressHighlighting={true}
|
|
33
|
-
>
|
|
34
|
-
Breakpoint value:
|
|
35
|
-
small
|
|
36
|
-
</Text>
|
|
37
|
-
<Text
|
|
38
|
-
style={
|
|
39
|
-
{
|
|
40
|
-
"fontFamily": "GTStandard",
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
suppressHighlighting={true}
|
|
44
|
-
>
|
|
45
|
-
SwitchBreakpoints value:
|
|
46
|
-
small
|
|
47
|
-
</Text>
|
|
48
|
-
</RNCSafeAreaProvider>
|
|
49
|
-
`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`bumper/utils/Breakpoints Breakpoints 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="css-view-g5y9jx r-flex-13awgt0"
|
|
7
|
-
>
|
|
8
|
-
<span
|
|
9
|
-
class=""
|
|
10
|
-
style="display: contents;"
|
|
11
|
-
>
|
|
12
|
-
<span
|
|
13
|
-
class=" "
|
|
14
|
-
style="display: contents;"
|
|
15
|
-
>
|
|
16
|
-
<span
|
|
17
|
-
class=" t_light is_Theme"
|
|
18
|
-
style="display: contents;"
|
|
19
|
-
>
|
|
20
|
-
<span
|
|
21
|
-
class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _display-inline _boxSizing-border-box _wordWrap-break-word _whiteSpace-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _fontFamily-f-family"
|
|
22
|
-
data-disable-theme="true"
|
|
23
|
-
>
|
|
24
|
-
Current breakpoint name: base
|
|
25
|
-
</span>
|
|
26
|
-
<span
|
|
27
|
-
class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _display-inline _boxSizing-border-box _wordWrap-break-word _whiteSpace-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _fontFamily-f-family"
|
|
28
|
-
data-disable-theme="true"
|
|
29
|
-
>
|
|
30
|
-
Breakpoint value: base
|
|
31
|
-
</span>
|
|
32
|
-
<span
|
|
33
|
-
class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _display-inline _boxSizing-border-box _wordWrap-break-word _whiteSpace-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _fontFamily-f-family"
|
|
34
|
-
data-disable-theme="true"
|
|
35
|
-
>
|
|
36
|
-
SwitchBreakpoints value: base
|
|
37
|
-
</span>
|
|
38
|
-
</span>
|
|
39
|
-
</span>
|
|
40
|
-
</span>
|
|
41
|
-
</div>
|
|
42
|
-
</DocumentFragment>
|
|
43
|
-
`;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
|
-
import type { View } from '@tamagui/core';
|
|
3
|
-
import type { ReactElement } from 'react';
|
|
4
|
-
import { Typography } from '../../content/typography/Typography';
|
|
5
|
-
import { SwitchBreakpoints } from './SwitchBreakpoins';
|
|
6
|
-
import { useBreakpointValue } from './hooks/useBreakpointValue';
|
|
7
|
-
import { useCurrentBreakpointName } from './hooks/useCurrentBreakpointName';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'bumper/utils/Breakpoints',
|
|
11
|
-
} satisfies Meta;
|
|
12
|
-
|
|
13
|
-
const CurrentBreakpointNameComponent = (): ReactElement => {
|
|
14
|
-
const breakpointName = useCurrentBreakpointName();
|
|
15
|
-
|
|
16
|
-
return <Typography.Text>Current breakpoint name: {breakpointName}</Typography.Text>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const BreakpointValueComponent = (): ReactElement => {
|
|
20
|
-
const value = useBreakpointValue({ base: 'base', small: 'small', medium: 'medium', large: 'large', wide: 'wide' });
|
|
21
|
-
|
|
22
|
-
return <Typography.Text>Breakpoint value: {value}</Typography.Text>;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const SwitchBreakpointsComponent = (): ReactElement => {
|
|
26
|
-
return (
|
|
27
|
-
<Typography.Text>
|
|
28
|
-
SwitchBreakpoints value: <SwitchBreakpoints base="base" small="small" medium="medium" large="large" wide="wide" />
|
|
29
|
-
</Typography.Text>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const BreakpointsStory: StoryFn<typeof View> = () => {
|
|
34
|
-
return (
|
|
35
|
-
<>
|
|
36
|
-
<CurrentBreakpointNameComponent />
|
|
37
|
-
|
|
38
|
-
<BreakpointValueComponent />
|
|
39
|
-
|
|
40
|
-
<SwitchBreakpointsComponent />
|
|
41
|
-
</>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
BreakpointsStory.storyName = 'Breakpoints';
|
|
File without changes
|