Skip to content

Commit

Permalink
chore: update color utils
Browse files Browse the repository at this point in the history
  • Loading branch information
billyjacoby committed Sep 23, 2023
1 parent 8b76342 commit 6efb536
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/baseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {ScrollView, ScrollViewProps, View, ViewProps} from 'react-native';

import clsx from 'clsx';

import {bgBackground} from '@utils';

type BaseViewProps =
| ({isScrollview?: never} & ViewProps)
| ({isScrollview: true} & ScrollViewProps);
Expand All @@ -11,16 +13,11 @@ export const BaseView = (props: BaseViewProps) => {
return (
<ScrollView
contentContainerStyle={{minHeight: '95%'}}
className={clsx('bg-background', 'dark:bg-background-dark', 'flex-1')}
className={clsx(bgBackground, 'flex-1')}
{...props}
/>
);
} else {
return (
<View
className={clsx('bg-background', 'dark:bg-background-dark')}
{...props}
/>
);
return <View className={bgBackground} {...props} />;
}
};
2 changes: 2 additions & 0 deletions src/utils/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ export const hslToHex = (HSL: string) => {
};
return `#${f(0)}${f(8)}${f(4)}`;
};

export const bgBackground = 'bg-background dark:bg-background-dark';
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './colors';
export * from './urls';
export * from './text';
9 changes: 9 additions & 0 deletions src/utils/text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const toTitleCase = (str: string) => {
return str
.toLowerCase()
.split(' ')
.map(function (word) {
return word.charAt(0).toUpperCase() + word.slice(1);
})
.join(' ');
};

0 comments on commit 6efb536

Please sign in to comment.