@jobber/components-native 0.98.3 → 0.98.5

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.
Files changed (47) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/Chip/Chip.style.js +0 -2
  3. package/dist/src/index.js +0 -1
  4. package/dist/src/utils/meta/meta.json +0 -1
  5. package/dist/tsconfig.build.tsbuildinfo +1 -1
  6. package/dist/types/src/Chip/Chip.style.d.ts +0 -2
  7. package/dist/types/src/index.d.ts +0 -1
  8. package/package.json +2 -2
  9. package/src/Chip/Chip.stories.tsx +49 -38
  10. package/src/Chip/Chip.style.ts +0 -2
  11. package/src/index.ts +0 -1
  12. package/src/utils/meta/meta.json +0 -1
  13. package/dist/src/Menu/Menu.js +0 -85
  14. package/dist/src/Menu/Menu.style.js +0 -7
  15. package/dist/src/Menu/components/MenuOption/MenuOption.js +0 -27
  16. package/dist/src/Menu/components/MenuOption/MenuOption.style.js +0 -11
  17. package/dist/src/Menu/components/MenuOption/index.js +0 -1
  18. package/dist/src/Menu/components/Overlay/Overlay.js +0 -10
  19. package/dist/src/Menu/components/Overlay/Overlay.style.js +0 -8
  20. package/dist/src/Menu/components/Overlay/index.js +0 -1
  21. package/dist/src/Menu/index.js +0 -1
  22. package/dist/src/Menu/types.js +0 -1
  23. package/dist/src/Menu/utils.js +0 -78
  24. package/dist/types/src/Menu/Menu.d.ts +0 -3
  25. package/dist/types/src/Menu/Menu.style.d.ts +0 -18
  26. package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +0 -3
  27. package/dist/types/src/Menu/components/MenuOption/MenuOption.style.d.ts +0 -8
  28. package/dist/types/src/Menu/components/MenuOption/index.d.ts +0 -1
  29. package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +0 -3
  30. package/dist/types/src/Menu/components/Overlay/Overlay.style.d.ts +0 -12
  31. package/dist/types/src/Menu/components/Overlay/index.d.ts +0 -1
  32. package/dist/types/src/Menu/index.d.ts +0 -2
  33. package/dist/types/src/Menu/types.d.ts +0 -26
  34. package/dist/types/src/Menu/utils.d.ts +0 -11
  35. package/src/Menu/Menu.stories.tsx +0 -52
  36. package/src/Menu/Menu.style.ts +0 -17
  37. package/src/Menu/Menu.test.tsx +0 -203
  38. package/src/Menu/Menu.tsx +0 -141
  39. package/src/Menu/components/MenuOption/MenuOption.style.tsx +0 -12
  40. package/src/Menu/components/MenuOption/MenuOption.tsx +0 -66
  41. package/src/Menu/components/MenuOption/index.ts +0 -1
  42. package/src/Menu/components/Overlay/Overlay.style.ts +0 -15
  43. package/src/Menu/components/Overlay/Overlay.tsx +0 -18
  44. package/src/Menu/components/Overlay/index.ts +0 -1
  45. package/src/Menu/index.ts +0 -6
  46. package/src/Menu/types.ts +0 -31
  47. package/src/Menu/utils.ts +0 -148
@@ -5,8 +5,6 @@ export declare const useStyles: () => {
5
5
  flexDirection: "row";
6
6
  height: number;
7
7
  justifyContent: "center";
8
- marginHorizontal: number;
9
- marginTop: number;
10
8
  paddingHorizontal: number;
11
9
  };
12
10
  iconLeft: {
@@ -35,7 +35,6 @@ export * from "./InputPressable";
35
35
  export * from "./InputSearch";
36
36
  export * from "./InputText";
37
37
  export * from "./InputTime";
38
- export * from "./Menu";
39
38
  export * from "./ProgressBar";
40
39
  export * from "./Select";
41
40
  export * from "./StatusLabel";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.98.3",
3
+ "version": "0.98.5",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -96,5 +96,5 @@
96
96
  "react-native-safe-area-context": "^5.4.0",
97
97
  "react-native-svg": ">=12.0.0"
98
98
  },
99
- "gitHead": "4edff1d8859ef42cd6ee00024ef9d40a598d825c"
99
+ "gitHead": "60dbce9880c63f02f43d8b3f1f5ef9090dba32e3"
100
100
  }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View } from "react-native";
3
3
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
4
- import { Chip } from "@jobber/components-native";
4
+ import { Chip, useAtlantisTheme } from "@jobber/components-native";
5
5
 
6
6
  const meta = {
7
7
  title: "Components/Selections/Chip",
@@ -29,43 +29,54 @@ export const Basic: Story = {
29
29
  },
30
30
  };
31
31
 
32
- const AccentTemplate = (args: Story["args"]) => (
33
- <View style={{ display: "flex", flexDirection: "row", flexWrap: "wrap" }}>
34
- <Chip {...args} />
35
- <Chip
36
- label="Select requests"
37
- accent="request"
38
- icon="request"
39
- onPress={() => alert("Requests")}
40
- accessibilityLabel={"Select Requests"}
41
- isActive={true}
42
- />
43
- <Chip
44
- label="Select quotes"
45
- accent="quote"
46
- icon="quote"
47
- onPress={() => alert("Quotes")}
48
- accessibilityLabel={"Select Quotes"}
49
- isActive={true}
50
- />
51
- <Chip
52
- label="Select jobs"
53
- accent="job"
54
- icon="job"
55
- onPress={() => alert("Jobs")}
56
- accessibilityLabel={"Select Jobs"}
57
- isActive={true}
58
- />
59
- <Chip
60
- label="Select invoices"
61
- accent="invoice"
62
- icon="invoice"
63
- onPress={() => alert("Invoices")}
64
- accessibilityLabel={"Select Invoices"}
65
- isActive={true}
66
- />
67
- </View>
68
- );
32
+ const AccentTemplate = (args: Story["args"]) => {
33
+ const { tokens } = useAtlantisTheme();
34
+
35
+ return (
36
+ <View
37
+ style={{
38
+ display: "flex",
39
+ flexDirection: "row",
40
+ flexWrap: "wrap",
41
+ gap: tokens["space-small"],
42
+ }}
43
+ >
44
+ <Chip {...args} />
45
+ <Chip
46
+ label="Select requests"
47
+ accent="request"
48
+ icon="request"
49
+ onPress={() => alert("Requests")}
50
+ accessibilityLabel={"Select Requests"}
51
+ isActive={true}
52
+ />
53
+ <Chip
54
+ label="Select quotes"
55
+ accent="quote"
56
+ icon="quote"
57
+ onPress={() => alert("Quotes")}
58
+ accessibilityLabel={"Select Quotes"}
59
+ isActive={true}
60
+ />
61
+ <Chip
62
+ label="Select jobs"
63
+ accent="job"
64
+ icon="job"
65
+ onPress={() => alert("Jobs")}
66
+ accessibilityLabel={"Select Jobs"}
67
+ isActive={true}
68
+ />
69
+ <Chip
70
+ label="Select invoices"
71
+ accent="invoice"
72
+ icon="invoice"
73
+ onPress={() => alert("Invoices")}
74
+ accessibilityLabel={"Select Invoices"}
75
+ isActive={true}
76
+ />
77
+ </View>
78
+ );
79
+ };
69
80
 
70
81
  export const Accent: Story = {
71
82
  render: AccentTemplate,
@@ -10,8 +10,6 @@ export const useStyles = buildThemedStyles(tokens => {
10
10
  flexDirection: "row",
11
11
  height: chipHeight,
12
12
  justifyContent: "center",
13
- marginHorizontal: tokens["space-smaller"],
14
- marginTop: tokens["space-small"],
15
13
  paddingHorizontal: tokens["space-base"],
16
14
  },
17
15
  iconLeft: {
package/src/index.ts CHANGED
@@ -35,7 +35,6 @@ export * from "./InputPressable";
35
35
  export * from "./InputSearch";
36
36
  export * from "./InputText";
37
37
  export * from "./InputTime";
38
- export * from "./Menu";
39
38
  export * from "./ProgressBar";
40
39
  export * from "./Select";
41
40
  export * from "./StatusLabel";
@@ -56,7 +56,6 @@
56
56
  "InputSearch",
57
57
  "InputText",
58
58
  "InputTime",
59
- "Menu",
60
59
  "Option",
61
60
  "ProgressBar",
62
61
  "Select",
@@ -1,85 +0,0 @@
1
- import React, { useCallback, useRef, useState } from "react";
2
- import { Keyboard, Platform, Pressable, View, useWindowDimensions, } from "react-native";
3
- import { Portal } from "react-native-portalize";
4
- import { useSafeAreaFrame } from "react-native-safe-area-context";
5
- import { useStyles } from "./Menu.style";
6
- import { findViewpoint } from "./utils";
7
- import { MenuOption } from "./components/MenuOption";
8
- import { Overlay } from "./components/Overlay";
9
- import { Button } from "../Button";
10
- import { Content } from "../Content";
11
- import { useAtlantisContext } from "../AtlantisContext";
12
- import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
13
- import { useAtlantisTheme } from "../AtlantisThemeContext";
14
- export function Menu({ menuOptions, customActivator }) {
15
- const [open, setOpen] = useState(false);
16
- const [menuPosition, setMenuPosition] = useState();
17
- const activatorLayout = useRef(null);
18
- const menuButtonRef = useRef(null);
19
- const screenInfo = useScreenInformation();
20
- const { t } = useAtlantisI18n();
21
- const styles = useStyles();
22
- const findMenuLayout = useCallback(() => {
23
- if (activatorLayout.current) {
24
- setMenuPosition(findViewpoint(screenInfo, activatorLayout.current, styles));
25
- }
26
- }, [screenInfo, activatorLayout, styles]);
27
- const openMenu = () => {
28
- var _a;
29
- (_a = menuButtonRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow((x, y, width, height) => {
30
- activatorLayout.current = {
31
- x,
32
- y,
33
- width,
34
- height,
35
- };
36
- findMenuLayout();
37
- setOpen(true);
38
- });
39
- };
40
- const activatorOnPress = (onPress) => {
41
- onPress && onPress();
42
- if (Platform.OS === "ios" && Keyboard.isVisible()) {
43
- // On iOS, the keyboard height causes problems with the menu positioning logic.
44
- // Wait until the keyboard is fully hidden before we show the menu.
45
- onKeyboardDidHide(openMenu);
46
- Keyboard.dismiss();
47
- }
48
- else {
49
- openMenu();
50
- }
51
- };
52
- const { tokens } = useAtlantisTheme();
53
- return (React.createElement(React.Fragment, null,
54
- React.createElement(View, { ref: ref => {
55
- menuButtonRef.current = ref;
56
- }, collapsable: false },
57
- customActivator && (React.createElement(Pressable, { style: ({ pressed }) => [
58
- {
59
- opacity: pressed ? tokens["opacity-pressed"] : 1,
60
- },
61
- ], pointerEvents: "box-only", onPress: () => {
62
- activatorOnPress(customActivator.props.onPress);
63
- }, onLongPress: customActivator.props.onLongPress }, customActivator)),
64
- !customActivator && (React.createElement(Button, { icon: "more", accessibilityLabel: t("menu"), variation: "cancel", type: "tertiary", onPress: () => {
65
- activatorOnPress();
66
- } }))),
67
- React.createElement(Portal, null, open && (React.createElement(React.Fragment, null,
68
- React.createElement(Overlay, { setOpen: setOpen }),
69
- React.createElement(View, { style: [open && menuPosition, styles.menu] },
70
- React.createElement(Content, { spacing: "none", childSpacing: "small" }, menuOptions === null || menuOptions === void 0 ? void 0 : menuOptions.map((menuOption, index) => {
71
- return (React.createElement(MenuOption, Object.assign({}, menuOption, { key: index, setOpen: setOpen })));
72
- }))))))));
73
- }
74
- function useScreenInformation() {
75
- const { headerHeight } = useAtlantisContext();
76
- const windowWidth = useWindowDimensions().width;
77
- const { height: windowHeight } = useSafeAreaFrame();
78
- return { headerHeight, windowWidth, windowHeight };
79
- }
80
- function onKeyboardDidHide(callback) {
81
- const listener = Keyboard.addListener("keyboardDidHide", () => {
82
- listener.remove();
83
- callback();
84
- });
85
- }
@@ -1,7 +0,0 @@
1
- import { buildThemedStyles } from "../AtlantisThemeContext";
2
- const menuWidth = 208;
3
- export const useStyles = buildThemedStyles(tokens => {
4
- return {
5
- menu: Object.assign({ position: "absolute", backgroundColor: tokens["color-surface"], paddingHorizontal: tokens["space-small"], paddingVertical: tokens["space-small"] + tokens["space-smallest"], borderRadius: tokens["radius-base"], width: menuWidth }, tokens["shadow-high"]),
6
- };
7
- });
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- import { Pressable, View } from "react-native";
3
- import capitalize from "lodash/capitalize";
4
- import { useStyles } from "./MenuOption.style";
5
- import { Flex } from "../../../Flex";
6
- import { Typography } from "../../../Typography";
7
- import { Icon } from "../../../Icon";
8
- import { useAtlantisTheme } from "../../../AtlantisThemeContext";
9
- export function MenuOption({ label, icon, iconColor = "heading", textAlign, destructive, textTransform = "capitalize", onPress, setOpen, }) {
10
- const destructiveColor = "destructive";
11
- const textVariation = destructive ? destructiveColor : "heading";
12
- const styles = useStyles();
13
- const { tokens } = useAtlantisTheme();
14
- return (React.createElement(View, { testID: "ATL-MENU-OPTIONS" },
15
- React.createElement(Pressable, { style: ({ pressed }) => [
16
- styles.menuOption,
17
- { opacity: pressed ? tokens["opacity-pressed"] : 1 },
18
- ], onPress: () => {
19
- onPress();
20
- setOpen(false);
21
- }, accessibilityLabel: label },
22
- React.createElement(Flex, { template: ["grow", "shrink"], align: "flex-start", gap: "smaller" },
23
- React.createElement(Typography, { selectable: false, color: textVariation, fontWeight: "semiBold", lineHeight: "large", align: textAlign }, textTransform === "capitalize"
24
- ? capitalize(label.toLocaleLowerCase())
25
- : label),
26
- icon && (React.createElement(Icon, { name: icon, color: destructive ? destructiveColor : iconColor }))))));
27
- }
@@ -1,11 +0,0 @@
1
- import { buildThemedStyles } from "../../../AtlantisThemeContext";
2
- export const useStyles = buildThemedStyles(tokens => {
3
- return {
4
- menuOption: {
5
- display: "flex",
6
- paddingHorizontal: tokens["space-base"],
7
- paddingVertical: tokens["space-small"],
8
- borderRadius: tokens["radius-large"],
9
- },
10
- };
11
- });
@@ -1 +0,0 @@
1
- export { MenuOption } from "./MenuOption";
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { Pressable, View } from "react-native";
3
- import { useStyles } from "./Overlay.style";
4
- export function Overlay({ setOpen }) {
5
- const styles = useStyles();
6
- return (React.createElement(Pressable, { onPressIn: () => {
7
- setOpen(false);
8
- } },
9
- React.createElement(View, { style: styles.overlay })));
10
- }
@@ -1,8 +0,0 @@
1
- import { Dimensions, StyleSheet } from "react-native";
2
- import { buildThemedStyles } from "../../../AtlantisThemeContext";
3
- const { height } = Dimensions.get("window");
4
- export const useStyles = buildThemedStyles(tokens => {
5
- return {
6
- overlay: Object.assign(Object.assign({}, StyleSheet.absoluteFillObject), { backgroundColor: tokens["color-overlay"], opacity: 0, height }),
7
- };
8
- });
@@ -1 +0,0 @@
1
- export { Overlay } from "./Overlay";
@@ -1 +0,0 @@
1
- export { Menu } from "./Menu";
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- export function findViewpoint(screenInfo, activatorLayout, styles) {
2
- const { windowHeight, windowWidth, headerHeight } = screenInfo;
3
- const pos = {};
4
- const menuWidth = styles.menu.width;
5
- const windowHalf = (windowHeight - headerHeight) / 2 + headerHeight;
6
- const menuPositionVertical = activatorLayout.y + activatorLayout.height > windowHalf
7
- ? "menuAbove"
8
- : "menuBelow";
9
- const menuPositionHorizontal = windowWidth / 2 > activatorLayout.width / 2 + activatorLayout.x
10
- ? "menuRight"
11
- : "menuLeft";
12
- const menuPadding = 36;
13
- getVerticalPosition(pos, windowHeight, activatorLayout, menuPositionVertical);
14
- getHorizontalPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth, menuPositionHorizontal);
15
- return pos;
16
- }
17
- function getVerticalPosition(pos, windowHeight, activatorLayout, menuPositionVertical) {
18
- if (menuPositionVertical === "menuAbove") {
19
- getAbovePosition(pos, windowHeight, activatorLayout);
20
- }
21
- if (menuPositionVertical === "menuBelow") {
22
- getBelowPosition(pos, activatorLayout);
23
- }
24
- }
25
- function getBelowPosition(pos, activatorLayout) {
26
- pos.top = activatorLayout.y + activatorLayout.height;
27
- }
28
- function getAbovePosition(pos, windowHeight, activatorLayout) {
29
- pos.bottom = windowHeight - activatorLayout.y;
30
- }
31
- function getHorizontalPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth, menuPositionHorizontal) {
32
- if (menuPositionHorizontal === "menuRight") {
33
- getRightPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth);
34
- }
35
- if (menuPositionHorizontal === "menuLeft") {
36
- getLeftPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth);
37
- }
38
- }
39
- function getLeftPosition(pos, activatorLayout, windowWidth, menuHorizontalPadding, menuWidth) {
40
- const overflowLeft = windowWidth -
41
- activatorLayout.x -
42
- activatorLayout.width +
43
- activatorLayout.width / 2 -
44
- menuHorizontalPadding +
45
- menuWidth >
46
- windowWidth;
47
- const overflowRight = windowWidth -
48
- activatorLayout.x -
49
- activatorLayout.width +
50
- activatorLayout.width / 2 -
51
- menuHorizontalPadding <
52
- 0;
53
- if (overflowLeft) {
54
- pos.right = undefined;
55
- pos.left = 0;
56
- }
57
- else if (overflowRight) {
58
- pos.right = 0;
59
- }
60
- else {
61
- pos.right = windowWidth - activatorLayout.x - activatorLayout.width;
62
- }
63
- }
64
- function getRightPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth) {
65
- const overflowRight = activatorLayout.x + activatorLayout.width / 2 - menuPadding + menuWidth >
66
- windowWidth;
67
- const overflowLeft = activatorLayout.x + activatorLayout.width / 2 - menuPadding < 0;
68
- if (overflowRight) {
69
- pos.left = undefined;
70
- pos.right = 0;
71
- }
72
- else if (overflowLeft) {
73
- pos.left = 0;
74
- }
75
- else {
76
- pos.left = activatorLayout.x;
77
- }
78
- }
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- import type { MenuProps } from "./types";
3
- export declare function Menu({ menuOptions, customActivator }: MenuProps): React.JSX.Element;
@@ -1,18 +0,0 @@
1
- export declare const useStyles: () => {
2
- menu: {
3
- shadowColor: string;
4
- shadowOffset: {
5
- width: number;
6
- height: number;
7
- };
8
- shadowOpacity: number;
9
- shadowRadius: number;
10
- elevation: number;
11
- position: "absolute";
12
- backgroundColor: string;
13
- paddingHorizontal: number;
14
- paddingVertical: number;
15
- borderRadius: number;
16
- width: number;
17
- };
18
- };
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- import type { MenuOptionInternalProps } from "../../types";
3
- export declare function MenuOption({ label, icon, iconColor, textAlign, destructive, textTransform, onPress, setOpen, }: MenuOptionInternalProps): React.JSX.Element;
@@ -1,8 +0,0 @@
1
- export declare const useStyles: () => {
2
- menuOption: {
3
- display: "flex";
4
- paddingHorizontal: number;
5
- paddingVertical: number;
6
- borderRadius: number;
7
- };
8
- };
@@ -1 +0,0 @@
1
- export { MenuOption } from "./MenuOption";
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- import type { OverlayProp } from "../../types";
3
- export declare function Overlay({ setOpen }: OverlayProp): React.JSX.Element;
@@ -1,12 +0,0 @@
1
- export declare const useStyles: () => {
2
- overlay: {
3
- backgroundColor: string;
4
- opacity: number;
5
- height: number;
6
- position: "absolute";
7
- left: 0;
8
- right: 0;
9
- top: 0;
10
- bottom: 0;
11
- };
12
- };
@@ -1 +0,0 @@
1
- export { Overlay } from "./Overlay";
@@ -1,2 +0,0 @@
1
- export { Menu } from "./Menu";
2
- export type { MenuProps, MenuOptionProps, MenuOptionInternalProps, } from "./types";
@@ -1,26 +0,0 @@
1
- import type { ReactElement } from "react";
2
- import type { IconColorNames, IconNames } from "@jobber/design";
3
- import type { TextAlign } from "../Typography";
4
- export interface MenuOptionProps {
5
- readonly label: string;
6
- readonly icon?: IconNames;
7
- readonly iconColor?: IconColorNames;
8
- readonly textAlign?: TextAlign;
9
- readonly destructive?: boolean;
10
- readonly textTransform?: "none" | "capitalize";
11
- onPress: () => void;
12
- }
13
- export interface MenuOptionInternalProps extends MenuOptionProps {
14
- setOpen: (bool: boolean) => void;
15
- }
16
- export interface CustomActivatorProps {
17
- readonly onPress?: () => void;
18
- readonly onLongPress?: () => void;
19
- }
20
- export interface MenuProps {
21
- readonly menuOptions?: MenuOptionProps[];
22
- readonly customActivator?: ReactElement<CustomActivatorProps>;
23
- }
24
- export interface OverlayProp {
25
- setOpen: (bool: boolean) => void;
26
- }
@@ -1,11 +0,0 @@
1
- import type { LayoutRectangle } from "react-native";
2
- import type { useStyles } from "./Menu.style";
3
- interface ScreenInfo {
4
- windowHeight: number;
5
- headerHeight: number;
6
- windowWidth: number;
7
- }
8
- export declare function findViewpoint(screenInfo: ScreenInfo, activatorLayout: LayoutRectangle, styles: ReturnType<typeof useStyles>): {
9
- [key: string]: number | undefined;
10
- };
11
- export {};
@@ -1,52 +0,0 @@
1
- import React, { useState } from "react";
2
- import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import type { IconNames } from "@jobber/design";
4
- import { SafeAreaProvider } from "react-native-safe-area-context";
5
- import { Host } from "react-native-portalize";
6
- import { Menu } from "@jobber/components-native";
7
-
8
- const meta = {
9
- title: "Components/Navigation/Menu",
10
- component: Menu,
11
- parameters: {
12
- viewport: { defaultViewport: "mobile1" },
13
- showNativeOnWebDisclaimer: true,
14
- },
15
- } satisfies Meta<typeof Menu>;
16
- export default meta;
17
- type Story = StoryObj<Partial<React.ComponentProps<typeof Menu>>>;
18
-
19
- const BasicTemplate = (args: Story["args"]) => {
20
- const [selected, setSelected] = useState(0);
21
-
22
- const menuOptions = [
23
- {
24
- label: "Option one",
25
- icon: selected === 1 ? ("checkmark" as IconNames) : undefined,
26
- onPress: () => setSelected(1),
27
- },
28
- {
29
- label: "Option two",
30
- icon: selected === 2 ? ("checkmark" as IconNames) : undefined,
31
- onPress: () => setSelected(2),
32
- },
33
- {
34
- label: "Option three",
35
- icon: selected === 3 ? ("checkmark" as IconNames) : undefined,
36
- onPress: () => setSelected(3),
37
- },
38
- ];
39
-
40
- return (
41
- <SafeAreaProvider>
42
- <Host>
43
- <Menu {...args} menuOptions={menuOptions} />
44
- </Host>
45
- </SafeAreaProvider>
46
- );
47
- };
48
-
49
- export const Basic: Story = {
50
- render: BasicTemplate,
51
- args: {},
52
- };
@@ -1,17 +0,0 @@
1
- import { buildThemedStyles } from "../AtlantisThemeContext";
2
-
3
- const menuWidth = 208;
4
-
5
- export const useStyles = buildThemedStyles(tokens => {
6
- return {
7
- menu: {
8
- position: "absolute",
9
- backgroundColor: tokens["color-surface"],
10
- paddingHorizontal: tokens["space-small"],
11
- paddingVertical: tokens["space-small"] + tokens["space-smallest"],
12
- borderRadius: tokens["radius-base"],
13
- width: menuWidth,
14
- ...tokens["shadow-high"],
15
- },
16
- };
17
- });