Skip to content

Commit

Permalink
[FEAT] #38 StickyNotification 컴포넌트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-Sunho committed Oct 21, 2024
1 parent 602ae50 commit 92779d5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
48 changes: 48 additions & 0 deletions app/src/components/StickyNotification.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import CloseSvg from 'assets/images/CloseSvg';
import { Dimensions } from 'react-native';
import styled from 'styled-components/native';
import DefaultText from './DefaultText';
import { Typo } from 'constants/typo';
import { Palette } from 'constants/palette';
import { useState } from 'react';

const width = Dimensions.get('window').width;

const Container = styled.View<{active: boolean}>`
display: ${props => props.active ? 'flex' : 'none'};
position: absolute;
top: 16px;
left: 16px;
width: ${width - 32};
padding: 14px 12px 14px 14px;
z-index: 999;
background: rgba(45, 61, 92, 0.90);
border-radius: 10px;
`;

const TextNotification = styled(DefaultText)`
font-size: ${Typo.B3.fontSize};
font-weight: ${Typo.B3.fontWeight};
color: ${Palette.Gray1};
`

const BtnClose = styled.TouchableOpacity`
position: absolute;
top: 14px;
right: 12px;
width: 12px;
height: 12px;
z-index: 10;
`;

export default function StickyNotification({content}: {content: string}) {
const [notification, setNotification] = useState<boolean>(true);
return (
<Container active={notification}>
<BtnClose onPress={() => setNotification(false)}>
<CloseSvg width='12' height='12' />
</BtnClose>
<TextNotification>{content}</TextNotification>
</Container>
);
}
2 changes: 2 additions & 0 deletions app/src/screens/reportNewBin/ReportNewBin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as S from 'screens/reportNewBin/ReportNewBin.style';
import { NavigationProp, useNavigation } from '@react-navigation/native';
import LocationSvg from 'assets/images/LocationSvg';
import { Palette } from 'constants/palette';
import StickyNotification from 'components/StickyNotification';

export default function ReportNewBin() {
const webViewRef = useRef<WebView>(null);
Expand Down Expand Up @@ -130,6 +131,7 @@ export default function ReportNewBin() {

return (
<View style={styles.container}>
<StickyNotification content='The blue dots show where the bins already are!'/>
<WebView
ref={webViewRef}
style={styles.webview}
Expand Down

0 comments on commit 92779d5

Please sign in to comment.