@equinor/mad-core
Version:
Core library for the Mobile App Delivery team
38 lines (36 loc) • 1.21 kB
JavaScript
// src/components/service-message/components/SwipeItem.tsx
import { EDSStyleSheet, Icon, PressableHighlight, Typography, useStyles } from "@equinor/mad-components";
import React from "react";
var SwipeItem = ({
title,
iconName,
color,
onPress
}) => {
const styles = useStyles(themeStyles, { color });
return /* @__PURE__ */ React.createElement(
PressableHighlight,
{
style: styles.container,
onPress
},
iconName && /* @__PURE__ */ React.createElement(Icon, { name: iconName, style: styles.textStyle, size: title ? void 0 : 28 }),
title && /* @__PURE__ */ React.createElement(Typography, { group: "interactive", variant: "button", style: styles.textStyle }, title)
);
};
var themeStyles = EDSStyleSheet.create((theme, props) => ({
container: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing.button.iconGap,
backgroundColor: props.color ? theme.colors.interactive[props.color] : theme.colors.interactive.primary,
paddingHorizontal: theme.spacing.element.paddingHorizontal,
paddingVertical: theme.spacing.element.paddingVertical
},
textStyle: {
color: theme.colors.text.primaryInverted
}
}));
export {
SwipeItem
};