forked from sdp-tech/UPCY_Mobile
-
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.
sdp-tech#11 feat: add heart, footer, bottom button component
- Loading branch information
Showing
6 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,30 @@ | ||
import { useState } from 'react'; | ||
import { View, TouchableOpacity } from 'react-native'; | ||
import styled from 'styled-components/native'; | ||
import { Body16M } from '../styles/GlobalText'; | ||
import { PURPLE, GREEN } from '../styles/GlobalColor'; | ||
|
||
interface BottomButtonParams { | ||
value: string; | ||
pressed: boolean; | ||
onPress: () => void; | ||
} | ||
|
||
const BottomButton = ({ value, pressed, onPress }: BottomButtonParams) => { | ||
return ( | ||
<ButtonContainer pressed={pressed} onPress={onPress}> | ||
<Body16M style={{color: pressed ? PURPLE : 'white'}}>{value}</Body16M> | ||
</ButtonContainer> | ||
) | ||
} | ||
|
||
const ButtonContainer = styled.TouchableOpacity<{ pressed: boolean }>` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: 8px; | ||
padding: 10px 90px; | ||
background-color: ${(props: { pressed: boolean; }) => props.pressed ? GREEN : PURPLE}; | ||
` | ||
|
||
export default BottomButton; |
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,31 @@ | ||
import { useState } from 'react'; | ||
import styled from 'styled-components/native'; | ||
import HeartButton from './HeartButton'; | ||
import BottomButton from './BottomButton'; | ||
|
||
const Footer = () => { | ||
// API 연결 전, 인터랙션만 | ||
const [like, setLike] = useState<boolean>(false); | ||
const [pressed, setPressed] = useState<boolean>(false); | ||
return ( | ||
<FooterContainer> | ||
<HeartButton like={like} onPress={() => setLike(!like)} /> | ||
<BottomButton value={'견적서 보내기'} pressed={pressed} onPress={() => setPressed(!pressed)} /> | ||
</FooterContainer> | ||
) | ||
} | ||
|
||
const FooterContainer = styled.View` | ||
position: absolute; | ||
bottom: 0px; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
flex: 1; | ||
align-items: center; | ||
justify-content: space-between; | ||
background-color: white; | ||
padding: 5px 15px; | ||
` | ||
|
||
export default Footer; |
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,19 @@ | ||
import React from 'react'; | ||
import { TouchableOpacity } from 'react-native'; | ||
import Heart from '../assets/common/Heart.svg'; | ||
import { PURPLE } from '../styles/GlobalColor'; | ||
|
||
interface HeartProps { | ||
like: boolean; | ||
onPress: () => void; | ||
} | ||
|
||
const HeartButton = ({ like, onPress }: HeartProps) => { | ||
return ( | ||
<TouchableOpacity onPress={onPress} style={{display:'flex', alignItems:'center'}}> | ||
<Heart color={like ? '#FF0000' : PURPLE} fill={like ? '#FF0000' : 'none'} /> | ||
</TouchableOpacity> | ||
) | ||
} | ||
|
||
export default HeartButton; |
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