-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepping code for ability to theme in react native
- Loading branch information
1 parent
8275042
commit 822e353
Showing
24 changed files
with
179 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
libs/features/src/lib/cart/cart.modal/cart.modal.content.scroll.native.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/use.render.styles'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useMemo } from 'react'; | ||
|
||
import { useThemeStore } from '@pokemon-pet-shop/store'; | ||
import { DetectEnum } from '@pokemon-pet-shop/typing'; | ||
import { detectUtil } from '@pokemon-pet-shop/utils'; | ||
|
||
export const useRenderStyles = (styles: any): any => { | ||
const theme = useThemeStore(); | ||
const newStyles = useMemo(() => { | ||
if (detectUtil() === DetectEnum.IS_WEB) { | ||
return styles; | ||
} | ||
|
||
return styles(theme); | ||
}, [styles, theme]); | ||
|
||
return { newStyles }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum DetectEnum { | ||
IS_WEB = 'isWeb', | ||
IS_NATIVE = 'isNative', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './alignment.enum'; | ||
export * from './detect.enum'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* Styles */ | ||
// export * from './lib-base/styles'; | ||
|
||
/* Providers */ | ||
// export * from './lib/providers'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* Box sizing rules */ | ||
*, | ||
*::before, | ||
*::after { | ||
box-sizing: border-box; | ||
} | ||
|
||
/* Prevent font size inflation */ | ||
html, | ||
body { | ||
text-size-adjust: none; | ||
text-size-adjust: none; | ||
text-size-adjust: none; | ||
margin: 0; | ||
} | ||
|
||
/* Remove default margin in favour of better control in authored CSS */ | ||
body, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
p, | ||
figure, | ||
blockquote, | ||
dl, | ||
dd { | ||
margin-block-end: 0; | ||
margin-block-start: 0; | ||
} | ||
|
||
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */ | ||
ul[role='list'], | ||
ol[role='list'] { | ||
list-style: none; | ||
} | ||
|
||
/* Set core body defaults */ | ||
body { | ||
min-height: 100vh; | ||
line-height: 1.5; | ||
} | ||
|
||
/* Set shorter line heights on headings and interactive elements */ | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
button, | ||
input, | ||
label { | ||
line-height: 1.1; | ||
} | ||
|
||
/* Balance text wrapping on headings */ | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6 { | ||
text-wrap: balance; | ||
margin: 0; | ||
} | ||
|
||
/* A elements that don't have a class get default styles */ | ||
a:not([class]) { | ||
text-decoration-skip-ink: auto; | ||
color: currentcolor; | ||
} | ||
|
||
/* Make images easier to work with */ | ||
img, | ||
picture { | ||
max-width: 100%; | ||
display: block; | ||
} | ||
|
||
/* Inherit fonts for inputs and buttons */ | ||
input, | ||
button, | ||
textarea, | ||
select { | ||
font-family: inherit; | ||
font-size: inherit; | ||
} | ||
|
||
/* Make sure textareas without a rows attribute are not tiny */ | ||
textarea:not([rows]) { | ||
min-height: 10em; | ||
} | ||
|
||
/* Anything that has been anchored to should have extra scroll margin */ | ||
:target { | ||
scroll-margin-block: 5ex; | ||
} | ||
|
||
:root, | ||
html[data-theme='light'] { | ||
--background-color: #fff; | ||
--text-color: #121416d8; | ||
--link-color: #543fd7; | ||
} | ||
|
||
html[data-theme='dark'] { | ||
--background-color: #212a2e; | ||
--text-color: #f7f8f8; | ||
--link-color: #828fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const lightTheme = { | ||
grey600: '#707274', | ||
}; | ||
|
||
export const darkTheme = { | ||
grey600: '#434343', | ||
}; |
6 changes: 5 additions & 1 deletion
6
libs/ui/src/lib-base/ui/tag/tag.item/tag.item.module.native.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
export const styles = StyleSheet.create({ | ||
card: { | ||
tag: { | ||
borderRadius: 100, | ||
paddingTop: 10, | ||
paddingBottom: 10, | ||
paddingLeft: 15, | ||
paddingRight: 15, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
libs/ui/src/lib-base/ui/tag/tag.wrapper/tag.wrapper.module.native.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
export const styles = StyleSheet.create({ | ||
card: { | ||
borderRadius: 100, | ||
tagWrapper: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
gap: 15, | ||
}, | ||
leftAlign: { | ||
justifyContent: 'flex-start', | ||
}, | ||
centerAlign: { | ||
justifyContent: 'center', | ||
}, | ||
rightAlign: { | ||
justifyContent: 'flex-end', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const detectUtil = () => { | ||
return 'isNative'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const detectUtil = () => { | ||
return 'isWeb'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters