|
|
@@ -0,0 +1,118 @@
|
|
|
+import {
|
|
|
+ type TextStyle,
|
|
|
+ type ViewStyle,
|
|
|
+ StyleSheet
|
|
|
+} from "react-native";
|
|
|
+import {
|
|
|
+ type StickerDynamicStyleType,
|
|
|
+ type StickerTypeConstantType,
|
|
|
+ type StickerTypes,
|
|
|
+ type StickerType
|
|
|
+} from "./type";
|
|
|
+import type {
|
|
|
+ Mutable
|
|
|
+} from "../../types";
|
|
|
+
|
|
|
+export const CHECK_BOX_TYPE_STYLES: Record<
|
|
|
+ StickerType,
|
|
|
+ {
|
|
|
+ containerColor: keyof NCoreUIKit.ContainerContentColors;
|
|
|
+ titleColor: keyof NCoreUIKit.TextContentColors;
|
|
|
+ iconColor: keyof NCoreUIKit.IconContentColors;
|
|
|
+ }
|
|
|
+> = {
|
|
|
+ primary: {
|
|
|
+ containerColor: "mid",
|
|
|
+ titleColor: "mid",
|
|
|
+ iconColor: "mid"
|
|
|
+ },
|
|
|
+ danger: {
|
|
|
+ containerColor: "danger",
|
|
|
+ titleColor: "danger",
|
|
|
+ iconColor: "danger"
|
|
|
+ },
|
|
|
+ success: {
|
|
|
+ containerColor: "success",
|
|
|
+ titleColor: "success",
|
|
|
+ iconColor: "success"
|
|
|
+ },
|
|
|
+ warning: {
|
|
|
+ containerColor: "warning",
|
|
|
+ titleColor: "warning",
|
|
|
+ iconColor: "warning"
|
|
|
+ },
|
|
|
+ info: {
|
|
|
+ containerColor: "info",
|
|
|
+ titleColor: "info",
|
|
|
+ iconColor: "info"
|
|
|
+ },
|
|
|
+ neutral: {
|
|
|
+ containerColor: "mid",
|
|
|
+ titleColor: "mid",
|
|
|
+ iconColor: "mid"
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+export const getStickerType = ({
|
|
|
+ type
|
|
|
+}: StickerTypeConstantType): StickerTypes => {
|
|
|
+ const currentType = CHECK_BOX_TYPE_STYLES[type];
|
|
|
+
|
|
|
+ return currentType;
|
|
|
+};
|
|
|
+
|
|
|
+const stylesheet = StyleSheet.create({
|
|
|
+ container: {
|
|
|
+ backgroundColor: "transparent",
|
|
|
+ justifyContent: "center",
|
|
|
+ flexDirection: "row",
|
|
|
+ alignItems: "center"
|
|
|
+ },
|
|
|
+ titleContainer: {
|
|
|
+ justifyContent: "flex-start",
|
|
|
+ flexDirection: "row",
|
|
|
+ alignItems: "center"
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ textAlign: "center",
|
|
|
+ margin: 0
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+export const useStyles = ({
|
|
|
+ iconPosition,
|
|
|
+ customColor,
|
|
|
+ currentType,
|
|
|
+ radiuses,
|
|
|
+ spaces,
|
|
|
+ colors,
|
|
|
+ size
|
|
|
+}: StickerDynamicStyleType) => {
|
|
|
+ const styles = {
|
|
|
+ container: {
|
|
|
+ paddingHorizontal: size === "small" ? spaces.spacingSm : spaces.spacingMd,
|
|
|
+ paddingVertical: size === "small" ? spaces.spacingXs : spaces.spacingSm,
|
|
|
+ backgroundColor: colors.content.container[currentType.containerColor],
|
|
|
+ borderRadius: radiuses.chip
|
|
|
+ } as Mutable<ViewStyle>,
|
|
|
+ titleContainer: {
|
|
|
+ } as Mutable<ViewStyle>,
|
|
|
+ title: {
|
|
|
+ } as Mutable<TextStyle>,
|
|
|
+ icon: {
|
|
|
+ } as Mutable<ViewStyle>
|
|
|
+ };
|
|
|
+
|
|
|
+ if(customColor) {
|
|
|
+ styles.container.backgroundColor = colors.content.container[customColor];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(iconPosition === "right") {
|
|
|
+ styles.icon.marginLeft = spaces.spacingXs;
|
|
|
+ } else {
|
|
|
+ styles.icon.marginRight = spaces.spacingXs;
|
|
|
+ }
|
|
|
+
|
|
|
+ return styles;
|
|
|
+};
|
|
|
+export default stylesheet;
|