From 0ddde3a1ac4e3dc1ae8955b05d978f82915c9eff Mon Sep 17 00:00:00 2001 From: wseungjin Date: Fri, 23 Apr 2021 17:03:34 +0900 Subject: [PATCH 1/5] style : add colors for reuse --- packages/mobile/src/styles/border.tsx | 84 +++++++++++++++++++++++- packages/mobile/src/styles/colors.tsx | 32 ++++++++-- packages/mobile/src/styles/font.tsx | 92 ++++++++++++++++++++++++++- packages/mobile/src/styles/layout.tsx | 80 +++++++++++++++++++++++ 4 files changed, 282 insertions(+), 6 deletions(-) diff --git a/packages/mobile/src/styles/border.tsx b/packages/mobile/src/styles/border.tsx index 19ca8a66f6..ea100d9d04 100644 --- a/packages/mobile/src/styles/border.tsx +++ b/packages/mobile/src/styles/border.tsx @@ -37,12 +37,94 @@ export const bcBlack: StyleProp = { borderColor: colors.black }; export const bcWhite: StyleProp = { borderColor: colors.white }; -export const bcPrimary: StyleProp = { borderColor: colors.primary }; +export const bcPrimary: StyleProp = { + borderColor: colors.primary, +}; + +export const bcPrimary50: StyleProp = { + borderColor: colors.primary50, +}; + +export const bcPrimary100: StyleProp = { + borderColor: colors.primary100, +}; + +export const bcPrimary200: StyleProp = { + borderColor: colors.primary200, +}; + +export const bcPrimary300: StyleProp = { + borderColor: colors.primary300, +}; + +export const bcPrimary400: StyleProp = { + borderColor: colors.primary400, +}; + +export const bcPrimary500: StyleProp = { + borderColor: colors.primary500, +}; + +export const bcPrimary600: StyleProp = { + borderColor: colors.primary600, +}; + +export const bcPrimary700: StyleProp = { + borderColor: colors.primary700, +}; + +export const bcPrimary800: StyleProp = { + borderColor: colors.primary800, +}; + +export const bcPrimary900: StyleProp = { + borderColor: colors.primary900, +}; export const bcSecondary: StyleProp = { borderColor: colors.secondary, }; +export const bcSecondary50: StyleProp = { + borderColor: colors.secondary50, +}; + +export const bcSecondary100: StyleProp = { + borderColor: colors.secondary100, +}; + +export const bcSecondary200: StyleProp = { + borderColor: colors.secondary200, +}; + +export const bcSecondary300: StyleProp = { + borderColor: colors.secondary300, +}; + +export const bcSecondary400: StyleProp = { + borderColor: colors.secondary400, +}; + +export const bcSecondary500: StyleProp = { + borderColor: colors.secondary500, +}; + +export const bcSecondary600: StyleProp = { + borderColor: colors.secondary600, +}; + +export const bcSecondary700: StyleProp = { + borderColor: colors.secondary700, +}; + +export const bcSecondary800: StyleProp = { + borderColor: colors.secondary800, +}; + +export const bcSecondary900: StyleProp = { + borderColor: colors.secondary900, +}; + export const bcWarining: StyleProp = { borderColor: colors.warning }; export const bcError: StyleProp = { borderColor: colors.error }; diff --git a/packages/mobile/src/styles/colors.tsx b/packages/mobile/src/styles/colors.tsx index e4a3557f14..e5dea29fd4 100644 --- a/packages/mobile/src/styles/colors.tsx +++ b/packages/mobile/src/styles/colors.tsx @@ -1,7 +1,31 @@ export const colors = { - primary: "#5e72e4", - secondary: "#11cdef", - default: "#1C3051", + primary: "#4762E7", + primary50: "#E3E7F7", + primary100: "#A9B6F5", + primary200: "#8E9FF2", + primary300: "#7388F0", + primary400: "#4762E7", + primary500: "#2644DB", + primary600: "#102FCB", + primary700: "#0320B4", + primary800: "#001A9A", + primary900: "#00157D", + secondary: "#FF63B4", + secondary50: "#EDD3E8", + secondary100: "#F3B1E1", + secondary200: "#FA9DD9", + secondary300: "#FF86CE", + secondary400: "#FF63B4", + secondary500: "#E753A8", + secondary600: "#C84699", + secondary700: "#A23A83", + secondary800: "#762C64", + secondary900: "#471D40", + default: "#2C4163", + high: "#132340", + medium: "#2C4163", + low: "#83838F", + verylow: "#899BB6", white: "#fff", black: "#000", grey5: "#dee2e6", @@ -12,7 +36,7 @@ export const colors = { grey0: "#32325d", greyOutline: "#e9ecef", success: "#2dce89", - error: "#f5365c", + error: "#F5365C", warning: "#fb6340", divider: "#e9ecef", }; diff --git a/packages/mobile/src/styles/font.tsx b/packages/mobile/src/styles/font.tsx index ea06003878..babcc71499 100644 --- a/packages/mobile/src/styles/font.tsx +++ b/packages/mobile/src/styles/font.tsx @@ -65,7 +65,89 @@ export const fcGrey5: StyleProp = { color: colors.grey5 }; export const fcPrimary: StyleProp = { color: colors.primary }; -export const fcSecondary: StyleProp = { color: colors.secondary }; +export const fcPrimary50: StyleProp = { + color: colors.primary50, +}; + +export const fcPrimary100: StyleProp = { + color: colors.primary100, +}; + +export const fcPrimary200: StyleProp = { + color: colors.primary200, +}; + +export const fcPrimary300: StyleProp = { + color: colors.primary300, +}; + +export const fcPrimary400: StyleProp = { + color: colors.primary400, +}; + +export const fcPrimary500: StyleProp = { + color: colors.primary500, +}; + +export const fcPrimary600: StyleProp = { + color: colors.primary600, +}; + +export const fcPrimary700: StyleProp = { + color: colors.primary700, +}; + +export const fcPrimary800: StyleProp = { + color: colors.primary800, +}; + +export const fcPrimary900: StyleProp = { + color: colors.primary900, +}; + +export const fcSecondary: StyleProp = { + color: colors.secondary, +}; + +export const fcSecondary50: StyleProp = { + color: colors.secondary50, +}; + +export const fcSecondary100: StyleProp = { + color: colors.secondary100, +}; + +export const fcSecondary200: StyleProp = { + color: colors.secondary200, +}; + +export const fcSecondary300: StyleProp = { + color: colors.secondary300, +}; + +export const fcSecondary400: StyleProp = { + color: colors.secondary400, +}; + +export const fcSecondary500: StyleProp = { + color: colors.secondary500, +}; + +export const fcSecondary600: StyleProp = { + color: colors.secondary600, +}; + +export const fcSecondary700: StyleProp = { + color: colors.secondary700, +}; + +export const fcSecondary800: StyleProp = { + color: colors.secondary800, +}; + +export const fcSecondary900: StyleProp = { + color: colors.secondary900, +}; export const fcWarining: StyleProp = { color: colors.warning }; @@ -73,6 +155,14 @@ export const fcError: StyleProp = { color: colors.error }; export const fcSuccess: StyleProp = { color: colors.success }; +export const fcHigh: StyleProp = { color: colors.high }; + +export const fcMedium: StyleProp = { color: colors.medium }; + +export const fcLow: StyleProp = { color: colors.low }; + +export const fcVerylow: StyleProp = { color: colors.verylow }; + export const fAlignLeft: StyleProp = { textAlign: "left" }; export const fAlignRight: StyleProp = { textAlign: "right" }; diff --git a/packages/mobile/src/styles/layout.tsx b/packages/mobile/src/styles/layout.tsx index c131dd9a5e..c0406c7079 100644 --- a/packages/mobile/src/styles/layout.tsx +++ b/packages/mobile/src/styles/layout.tsx @@ -163,10 +163,90 @@ export const bgcPrimary: StyleProp = { backgroundColor: colors.primary, }; +export const bgcPrimary50: StyleProp = { + backgroundColor: colors.primary50, +}; + +export const bgcPrimary100: StyleProp = { + backgroundColor: colors.primary100, +}; + +export const bgcPrimary200: StyleProp = { + backgroundColor: colors.primary200, +}; + +export const bgcPrimary300: StyleProp = { + backgroundColor: colors.primary300, +}; + +export const bgcPrimary400: StyleProp = { + backgroundColor: colors.primary400, +}; + +export const bgcPrimary500: StyleProp = { + backgroundColor: colors.primary500, +}; + +export const bgcPrimary600: StyleProp = { + backgroundColor: colors.primary600, +}; + +export const bgcPrimary700: StyleProp = { + backgroundColor: colors.primary700, +}; + +export const bgcPrimary800: StyleProp = { + backgroundColor: colors.primary800, +}; + +export const bgcPrimary900: StyleProp = { + backgroundColor: colors.primary900, +}; + export const bgcSecondary: StyleProp = { backgroundColor: colors.secondary, }; +export const bgcSecondary50: StyleProp = { + backgroundColor: colors.secondary50, +}; + +export const bgcSecondary100: StyleProp = { + backgroundColor: colors.secondary100, +}; + +export const bgcSecondary200: StyleProp = { + backgroundColor: colors.secondary200, +}; + +export const bgcSecondary300: StyleProp = { + backgroundColor: colors.secondary300, +}; + +export const bgcSecondary400: StyleProp = { + backgroundColor: colors.secondary400, +}; + +export const bgcSecondary500: StyleProp = { + backgroundColor: colors.secondary500, +}; + +export const bgcSecondary600: StyleProp = { + backgroundColor: colors.secondary600, +}; + +export const bgcSecondary700: StyleProp = { + backgroundColor: colors.secondary700, +}; + +export const bgcSecondary800: StyleProp = { + backgroundColor: colors.secondary800, +}; + +export const bgcSecondary900: StyleProp = { + backgroundColor: colors.secondary900, +}; + export const bgcWarining: StyleProp = { backgroundColor: colors.warning, }; From 0750dcc4cfdca4f7d626c0f0b048b4bb873338d2 Mon Sep 17 00:00:00 2001 From: wseungjin Date: Fri, 23 Apr 2021 17:04:13 +0900 Subject: [PATCH 2/5] style : add disabled style and disabledTitle style --- .../src/components/buttons/default-button.tsx | 22 ++++++++++++--- .../src/components/buttons/white-button.tsx | 27 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/packages/mobile/src/components/buttons/default-button.tsx b/packages/mobile/src/components/buttons/default-button.tsx index 6b51b26924..95c4d077e7 100644 --- a/packages/mobile/src/components/buttons/default-button.tsx +++ b/packages/mobile/src/components/buttons/default-button.tsx @@ -6,12 +6,24 @@ import { GestureResponderEvent, } from "react-native"; import { Button } from "react-native-elements"; -import { bw1, flex1, br1, px4, sf, buttonFont1, py3 } from "../../styles"; +import { + bw1, + flex1, + br1, + px4, + sf, + buttonFont1, + py3, + fcWhite, + bgcPrimary200, +} from "../../styles"; type DefalutButtonProps = { containerStyle?: StyleProp[]; buttonStyle?: StyleProp[]; titleStyle?: StyleProp[]; + disabledStyle?: StyleProp[]; + disabledTitleStyle?: StyleProp[]; disabled?: boolean; loading?: boolean; title: string; @@ -20,8 +32,10 @@ type DefalutButtonProps = { export const DefaultButton: FunctionComponent = ({ containerStyle = [], - buttonStyle = [], titleStyle = [], + buttonStyle = [], + disabledStyle = [], + disabledTitleStyle = [], title, disabled, loading, @@ -33,9 +47,11 @@ export const DefaultButton: FunctionComponent = ({ buttonStyle={sf([bw1, br1, px4, py3, ...buttonStyle])} titleStyle={sf([buttonFont1, ...titleStyle])} title={title} + disabled={disabled} + disabledStyle={sf([bgcPrimary200, ...disabledStyle])} + disabledTitleStyle={sf([fcWhite, ...disabledTitleStyle])} onPress={onPress} loading={loading} - disabled={disabled} /> ); }; diff --git a/packages/mobile/src/components/buttons/white-button.tsx b/packages/mobile/src/components/buttons/white-button.tsx index 4fb4302639..6d02f1604e 100644 --- a/packages/mobile/src/components/buttons/white-button.tsx +++ b/packages/mobile/src/components/buttons/white-button.tsx @@ -23,12 +23,18 @@ import { bgcWhite, buttonFont1, py3, + bcPrimary200, + fcPrimary200, + bcSecondary200, + fcSecondary200, } from "../../styles"; type WhiteButtonProps = { containerStyle?: StyleProp[]; buttonStyle?: StyleProp[]; titleStyle?: StyleProp[]; + disabledStyle?: StyleProp[]; + disabledTitleStyle?: StyleProp[]; disabled?: boolean; loading?: boolean; color?: "primary" | "secondary" | "error" | "warning"; @@ -40,6 +46,8 @@ export const WhiteButton: FunctionComponent = ({ containerStyle = [], buttonStyle = [], titleStyle = [], + disabledStyle = [], + disabledTitleStyle = [], title, color, disabled, @@ -61,6 +69,21 @@ export const WhiteButton: FunctionComponent = ({ } })(); + const [disabledBorderColor, disabledFontColor] = (() => { + switch (color) { + case "primary": + return [bcPrimary200, fcPrimary200]; + case "secondary": + return [bcSecondary200, fcSecondary200]; + case "warning": + return [bcWarining, fcWarining]; + case "error": + return [bcError, fcError]; + default: + return [bcPrimary, fcPrimary]; + } + })(); + return (