@artsy/palette-mobile 13.2.36 → 13.2.37
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/dist/elements/Chip/Chip.d.ts +8 -0
- package/dist/elements/Chip/Chip.js +26 -0
- package/dist/elements/Chip/Chip.stories.d.ts +7 -0
- package/dist/elements/Chip/Chip.stories.js +11 -0
- package/dist/elements/Chip/index.d.ts +1 -0
- package/dist/elements/Chip/index.js +1 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAnimationState, View } from "moti";
|
|
3
|
+
import { useColor, useSpace } from "../../utils/hooks";
|
|
4
|
+
import { Flex } from "../Flex";
|
|
5
|
+
import { Image } from "../Image";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
import { Touchable } from "../Touchable";
|
|
8
|
+
export const Chip = ({ image, title, subtitle, onPress }) => {
|
|
9
|
+
const color = useColor();
|
|
10
|
+
const space = useSpace();
|
|
11
|
+
const animatedState = useAnimationState({
|
|
12
|
+
from: { backgroundColor: color("black10") },
|
|
13
|
+
to: { backgroundColor: color("black5") },
|
|
14
|
+
});
|
|
15
|
+
const handleOnPressIn = () => {
|
|
16
|
+
animatedState.transitionTo("from");
|
|
17
|
+
};
|
|
18
|
+
const handleOnPressOut = () => {
|
|
19
|
+
animatedState.transitionTo("to");
|
|
20
|
+
};
|
|
21
|
+
return (_jsx(Touchable, { onPress: onPress, onPressIn: handleOnPressIn, onPressOut: handleOnPressOut, noFeedback: true, children: _jsxs(Flex, { flexDirection: "row", minWidth: 200, height: 70, overflow: "hidden", borderRadius: 5, children: [!!image && _jsx(Image, { src: image, width: 70, height: 70 }), _jsxs(View, { state: animatedState, style: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
padding: space(1),
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
}, children: [!!subtitle && (_jsx(Text, { variant: "xs", color: "black60", selectable: false, children: subtitle })), _jsx(Text, { variant: "sm-display", selectable: false, children: title })] })] }) }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from "react-native";
|
|
3
|
+
import { Chip } from "./Chip";
|
|
4
|
+
import { Flex } from "../Flex";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Chip",
|
|
7
|
+
component: Chip,
|
|
8
|
+
};
|
|
9
|
+
export const Variations = () => {
|
|
10
|
+
return (_jsxs(Flex, { p: 2, justifyContent: "center", alignItems: "center", gap: 20, children: [_jsx(Chip, { title: "Only title" }), _jsx(Chip, { title: "Title and subtitle", subtitle: "Subtitle" }), _jsx(Chip, { title: "Title and image", image: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }), _jsx(Chip, { title: "Title, subtitle and image", subtitle: "Cow image", image: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }), _jsx(Chip, { title: "Press me", subtitle: "Pressing alerts something", onPress: () => Alert.alert("Pressed") })] }));
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Chip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Chip";
|
package/dist/elements/index.d.ts
CHANGED
package/dist/elements/index.js
CHANGED
package/package.json
CHANGED