Skip to content

Commit a65c6b8

Browse files
authored
Merge pull request #1862 from gluestack/feat/eg-fab
Feat/eg fab
2 parents be1d84e + d8321b1 commit a65c6b8

File tree

4 files changed

+445
-95
lines changed

4 files changed

+445
-95
lines changed

example/storybook-nativewind/src/components-example/nativewind/Fab/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
withStyleContext,
77
withStyleContextAndStates,
88
useStyleContext,
9+
cssInterop,
910
} from '@gluestack-ui/nativewind-utils';
1011
import React from 'react';
11-
import { cssInterop } from 'nativewind';
1212

1313
export const UIFab = createFab({
1414
// @ts-ignore
@@ -26,7 +26,7 @@ cssInterop(UIFab.Label, { className: 'style' });
2626
cssInterop(UIFab.Icon, { className: 'style' });
2727

2828
const fabStyle = tva({
29-
base: 'group/fab bg-primary-500 rounded-full z-20 p-4 flex-row items-center justify-center absolute hover:bg-primary-600 active:bg-primary-700 disabled:opacity-40 disabled:pointer-events-all disabled:cursor-not-allowed data-[focus=true]:outline-2 data-[focus=true]:outline-primary-700 data-[focus=true]:outline-solid',
29+
base: 'group/fab bg-primary-500 rounded-full z-20 p-4 flex-row items-center justify-center absolute hover:bg-red-600 active:bg-primary-700 disabled:opacity-40 disabled:pointer-events-all disabled:cursor-not-allowed data-[focus=true]:outline-2 data-[focus=true]:outline-primary-700 data-[focus=true]:outline-solid',
3030
variants: {
3131
size: {
3232
sm: 'px-2.5 py-2.5 text-sm',

example/storybook-nativewind/src/components/Fab/Fab.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ const FabMeta: ComponentMeta<typeof Fab> = {
3535
figmaIgnore: true,
3636
options: [true, false],
3737
},
38+
isHovered: {
39+
control: 'boolean',
40+
figmaIgnore: true,
41+
options: [true, false],
42+
},
3843
},
3944
args: {
4045
placement: 'bottom right',
4146
showLabel: true,
4247
showIcon: true,
4348
size: 'md',
49+
isHovered: false,
4450
},
4551
};
4652

Lines changed: 30 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,29 @@
11
import React from 'react';
2-
2+
import { Fab, FabIcon, FabLabel } from '@/components/ui/Fab';
3+
import { Avatar, AvatarImage } from '@/components/ui/Avatar';
4+
import { AddIcon, MenuIcon, SearchIcon, CheckIcon } from '@/components/ui/Icon';
5+
import { Box } from '@/components/ui/Box';
36
import {
4-
AddIcon,
5-
Box,
6-
MenuIcon,
77
Checkbox,
88
CheckboxIndicator,
99
CheckboxLabel,
10-
SearchIcon,
11-
Link,
12-
VStack,
13-
HStack,
14-
Avatar,
15-
AvatarImage,
16-
Heading,
17-
Text,
18-
Divider,
19-
Image,
2010
CheckboxIcon,
21-
} from '@gluestack-ui/themed';
22-
23-
import { Fab, FabIcon, FabLabel } from '@/components/ui/Fab';
24-
25-
import { CheckIcon, EditIcon, ShoppingCartIcon } from 'lucide-react-native';
26-
27-
const FabBasic = ({
28-
placement = 'bottom right',
29-
showLabel = true,
30-
showIcon = true,
31-
...props
32-
}: any) => {
33-
return (
34-
<Box
35-
position="relative"
36-
bg="$trueGray200"
37-
h="$full"
38-
w="$full"
39-
sx={{ _web: { w: 300, h: 300 } }}
40-
>
41-
<Fab placement={placement} gap="$1" {...props}>
42-
{showIcon && <FabIcon as={MenuIcon} />}
43-
{showLabel && <FabLabel>Menu</FabLabel>}
44-
</Fab>
45-
</Box>
46-
);
47-
};
48-
49-
const FigmaFabStory = ({
50-
placement = 'bottom right',
51-
showLabel = true,
52-
_showIcon = true,
53-
...props
54-
}: any) => {
11+
} from '@/components/ui/Checkbox';
12+
import { Link } from '@/components/ui/Link';
13+
import { VStack } from '@/components/ui/VStack';
14+
import { HStack } from '@/components/ui/HStack';
15+
import { Heading } from '@/components/ui/Heading';
16+
import { Text } from '@/components/ui/Text';
17+
import { Divider } from '@/components/ui/Divider';
18+
import { Image } from '@/components/ui/Image';
19+
import { EditIcon, ShoppingCartIcon } from 'lucide-react-native';
20+
21+
const FabBasic = (props: any) => {
5522
return (
56-
<Box sx={{ _web: { w: 250, h: 80 } }}>
57-
<Fab placement={placement} {...props} gap="$1">
58-
<FabIcon as={MenuIcon} />
59-
{showLabel && <Fab.Label>Menu</Fab.Label>}
23+
<Box className="h-[300px] w-[300px] bg-background-200 rounded-md ">
24+
<Fab placement={props.placement} {...props}>
25+
{props.showIcon && <FabIcon as={MenuIcon} />}
26+
{props.showLabel && <FabLabel>Menu</FabLabel>}
6027
</Fab>
6128
</Box>
6229
);
@@ -68,27 +35,27 @@ FabBasic.description =
6835
export default FabBasic;
6936

7037
export {
71-
FigmaFabStory,
7238
Fab,
7339
FabIcon,
7440
FabLabel,
75-
SearchIcon,
76-
EditIcon,
77-
Box,
78-
VStack,
79-
HStack,
8041
Avatar,
8142
AvatarImage,
82-
Heading,
83-
Text,
84-
Divider,
8543
AddIcon,
44+
MenuIcon,
45+
SearchIcon,
46+
CheckIcon,
47+
Box,
8648
Checkbox,
8749
CheckboxIndicator,
8850
CheckboxLabel,
8951
CheckboxIcon,
90-
CheckIcon,
91-
Image,
9252
Link,
53+
VStack,
54+
HStack,
55+
Heading,
56+
Text,
57+
Divider,
58+
Image,
59+
EditIcon,
9360
ShoppingCartIcon,
9461
};

0 commit comments

Comments
 (0)