-
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.
Merge pull request #69 from alleyhector/45_card_refactor
45 card refactor
- Loading branch information
Showing
8 changed files
with
5,871 additions
and
2,121 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"prettier.arrowParens": "avoid", | ||
"prettier.enableDebugLogs": true, | ||
"prettier.jsxSingleQuote": true, | ||
"prettier.singleQuote": true, | ||
"files.autoSave": "afterDelay", | ||
"editor.tabSize": 2, | ||
"editor.wordWrap": "on", | ||
"editor.formatOnPaste": true, | ||
"prettier.semi": false, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} |
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,59 @@ | ||
import { FC } from 'react' | ||
import { View, Text } from '@/components/Themed' | ||
import { Image } from 'expo-image' | ||
import { ExternalLink as ExternalLinkComponent } from '../ExternalLink' | ||
import { | ||
apiImage, | ||
apiImageWrapper, | ||
apiTextContainer, | ||
apiTitle, | ||
row, | ||
} from '@/constants/Styles' | ||
import { memo } from 'react' | ||
|
||
interface CardProps { | ||
background: object | ||
imageUrl: string | ||
alt: string | ||
title: string | ||
description: string | ||
link: string | ||
} | ||
|
||
const ExternalLink = memo(ExternalLinkComponent) | ||
|
||
const Card: FC<CardProps> = ({ | ||
background, | ||
imageUrl, | ||
alt, | ||
title, | ||
description, | ||
link, | ||
}) => { | ||
return ( | ||
<ExternalLink href={link}> | ||
<View style={[row, background]}> | ||
<View style={apiImageWrapper}> | ||
{imageUrl && ( | ||
<Image | ||
source={{ uri: imageUrl }} | ||
alt={alt} | ||
style={[apiImage, background]} | ||
placeholder={require('@/assets/images/recipe-placeholder.png')} | ||
placeholderContentFit='cover' | ||
transition={1000} | ||
/> | ||
)} | ||
</View> | ||
<View style={[apiTextContainer, background]}> | ||
<View style={background}> | ||
<Text style={apiTitle}>{title}</Text> | ||
<Text>{description}</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</ExternalLink> | ||
) | ||
} | ||
|
||
export default Card |
Oops, something went wrong.