-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Bien
committed
Dec 13, 2020
1 parent
10089c5
commit d6910f4
Showing
8 changed files
with
146 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useContext } from 'react'; | ||
import { Card, Text } from 'react95-native'; | ||
|
||
import Container from '../util/Container'; | ||
import { LocalThemeContext } from '../util/LocalThemeContext'; | ||
|
||
const TextExample = () => { | ||
const { theme } = useContext(LocalThemeContext); | ||
return ( | ||
<Container style={[{ backgroundColor: theme.materialDark }]}> | ||
<Container.Section title='Default:'> | ||
<Card style={[{ height: 300 }]}> | ||
<Card.Content> | ||
<Text>Simple text</Text> | ||
</Card.Content> | ||
</Card> | ||
</Container.Section> | ||
|
||
<Container.Section title='High elevation:'> | ||
<Card elevation={8} style={[{ height: 100 }]}> | ||
<Card.Content> | ||
<Text>Simple text</Text> | ||
</Card.Content> | ||
</Card> | ||
</Container.Section> | ||
|
||
<Container.Section title='No elevation:'> | ||
<Card elevation={0} style={[{ height: 100 }]}> | ||
<Card.Content> | ||
<Text linkUrl='https://react95.io'>React95 website</Text> | ||
</Card.Content> | ||
</Card> | ||
</Container.Section> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default TextExample; |
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,75 @@ | ||
import React, { useContext } from 'react'; | ||
import { StyleProp, StyleSheet, ViewStyle, View } from 'react-native'; | ||
import { ThemeContext } from '../common/theming/Theme'; | ||
|
||
import CardContent from './CardContent'; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
style?: StyleProp<ViewStyle>; | ||
elevation?: number; | ||
}; | ||
|
||
const Card = ({ children, style = {}, elevation = 2 }: Props) => { | ||
const theme = useContext(ThemeContext); | ||
return ( | ||
<View style={[styles.wrapper, style]}> | ||
<View | ||
style={[ | ||
styles.inner, | ||
{ | ||
marginRight: elevation, | ||
marginBottom: elevation, | ||
}, | ||
]} | ||
> | ||
{elevation !== 0 && ( | ||
<View | ||
style={[ | ||
styles.shadow, | ||
{ | ||
top: elevation, | ||
left: elevation, | ||
width: '100%', | ||
height: '100%', | ||
backgroundColor: theme.borderDarkest, | ||
}, | ||
]} | ||
/> | ||
)} | ||
<View | ||
style={[ | ||
styles.card, | ||
{ | ||
backgroundColor: theme.canvas, | ||
borderColor: theme.borderDarkest, | ||
}, | ||
]} | ||
> | ||
{children} | ||
</View> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
flex: 1, | ||
position: 'relative', | ||
}, | ||
inner: { | ||
flexGrow: 1, | ||
}, | ||
card: { | ||
borderWidth: 2, | ||
flexGrow: 1, | ||
}, | ||
shadow: { | ||
position: 'absolute', | ||
}, | ||
}); | ||
|
||
Card.Content = CardContent; | ||
|
||
export default Card; |
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,25 @@ | ||
import React from 'react'; | ||
import { StyleProp, StyleSheet, ViewStyle, View } from 'react-native'; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
style?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
const CardContent = ({ children, style = {} }: Props) => { | ||
return ( | ||
<View style={[styles.wrapper, style]}> | ||
{children} | ||
</View> | ||
); | ||
}; | ||
|
||
|
||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
padding: 8, | ||
}, | ||
}); | ||
|
||
export default CardContent; |
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 default from './Card'; |
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