-
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.
Link component created • Updates to detect util and typography component
- Loading branch information
1 parent
d0df250
commit 3cae823
Showing
21 changed files
with
164 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
import { THEME_SPACING_10, THEME_SPACING_5 } from '@pokemon-pet-shop/ui/styles/var'; | ||
import { | ||
THEME_SPACING_10, | ||
THEME_SPACING_15, | ||
THEME_SPACING_45, | ||
} from '@pokemon-pet-shop/ui/styles/var'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
export const styles = () => | ||
StyleSheet.create({ | ||
footerWrapper: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
}, | ||
githubWrapper: { | ||
display: 'flex', | ||
}, | ||
githubIcon: { | ||
marginRight: THEME_SPACING_5, | ||
}, | ||
footerDivider: { | ||
paddingLeft: THEME_SPACING_10, | ||
paddingRight: THEME_SPACING_10, | ||
}, | ||
}); | ||
export const styles = StyleSheet.create({ | ||
footerWrapper: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
marginBottom: THEME_SPACING_45, | ||
}, | ||
githubWrapper: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
marginBottom: THEME_SPACING_15, | ||
}, | ||
githubIcon: { | ||
marginRight: THEME_SPACING_10, | ||
}, | ||
scanWrapper: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
marginBottom: THEME_SPACING_15, | ||
}, | ||
footerDivider: { | ||
display: 'none', | ||
}, | ||
}); |
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
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
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 @@ | ||
import UiLink from './link'; | ||
|
||
export { UiLink }; |
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 interface LinkProps { | ||
className?: string; | ||
link?: string | null; | ||
} |
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,26 @@ | ||
import { PropsWithChildren, ReactElement } from 'react'; | ||
|
||
import { UiElementLayout } from '../element.layout'; | ||
|
||
import { LinkProps } from './link.interface'; | ||
import { openLinkUtil } from './open.link.util'; | ||
|
||
const Link = ({ | ||
link = null, | ||
className = '', | ||
children, | ||
}: PropsWithChildren<LinkProps>): ReactElement => { | ||
const goToLink = () => { | ||
if (link) { | ||
openLinkUtil(link); | ||
} | ||
}; | ||
|
||
return ( | ||
<UiElementLayout className={className} onClick={goToLink}> | ||
{children} | ||
</UiElementLayout> | ||
); | ||
}; | ||
|
||
export default Link; |
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,6 @@ | ||
import * as Linking from 'expo-linking'; | ||
|
||
export const openLinkUtil = (link: string) => { | ||
console.log('link', link); | ||
Linking.openURL(link); | ||
}; |
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 openLinkUtil = (link: string) => { | ||
window.open(link, '_blank'); | ||
}; |
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
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,3 +1,11 @@ | ||
export const detectUtil = () => { | ||
return 'isNative'; | ||
}; | ||
|
||
export const isWebUtil = () => { | ||
return false; | ||
}; | ||
|
||
export const isNativeUtil = () => { | ||
return true; | ||
}; |
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,3 +1,11 @@ | ||
export const detectUtil = () => { | ||
return 'isWeb'; | ||
}; | ||
|
||
export const isWebUtil = () => { | ||
return true; | ||
}; | ||
|
||
export const isNativeUtil = () => { | ||
return false; | ||
}; |
Oops, something went wrong.