-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(desktop): add desktop component
- Loading branch information
Artur Bien
committed
Nov 30, 2020
1 parent
57ee228
commit 5c88248
Showing
6 changed files
with
156 additions
and
2 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,31 @@ | ||
import React from 'react'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import { Desktop, Panel, Fieldset } from 'react95-native'; | ||
|
||
const DesktopExample = () => { | ||
return ( | ||
<Panel style={styles.container}> | ||
<Fieldset label='Default:' style={[{ paddingVertical: 20 }]}> | ||
<Desktop style={[{ backgroundColor: 'teal' }]} /> | ||
</Fieldset> | ||
<Fieldset label='With children:' style={[{ paddingVertical: 20 }]}> | ||
<Desktop> | ||
<View style={[styles.child]} /> | ||
</Desktop> | ||
</Fieldset> | ||
</Panel> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
padding: 16, | ||
}, | ||
child: { | ||
backgroundColor: 'pink', | ||
flex: 1, | ||
}, | ||
}); | ||
|
||
export default DesktopExample; |
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,111 @@ | ||
import React from 'react'; | ||
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; | ||
import { Border } from '../common/styleElements'; | ||
import { original as theme } from '../common/themes'; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
style?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
const Desktop = ({ children, style }: Props) => { | ||
return ( | ||
<View style={[styles.wrapper]}> | ||
<View style={[styles.monitor]}> | ||
<Border variant='outside'> | ||
<View style={[styles.monitorShadowBorder]}> | ||
<View style={[styles.monitorShadowBorder]} /> | ||
</View> | ||
</Border> | ||
<View style={[styles.screen, style]}> | ||
<Border variant='cutout' /> | ||
{children} | ||
</View> | ||
<View style={[styles.light]} /> | ||
</View> | ||
<View style={[styles.stand]}> | ||
<View style={[styles.standSegmentOne]}> | ||
<Border variant='outside' /> | ||
</View> | ||
<View style={[styles.standSegmentTwo]}> | ||
<Border variant='default' /> | ||
</View> | ||
<View style={[styles.standSegmentThree]}> | ||
<Border variant='outside' /> | ||
</View> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
position: 'relative', | ||
width: 'auto', | ||
alignSelf: 'center', | ||
}, | ||
monitor: { | ||
position: 'relative', | ||
zIndex: 1, | ||
width: 195, | ||
height: 155, | ||
padding: 18, | ||
}, | ||
monitorShadowBorder: { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
bottom: 0, | ||
right: 0, | ||
borderWidth: 1, | ||
borderStyle: 'dotted', | ||
borderColor: theme.borderDark, | ||
// TODO: left and top dotted border shoulg be of light color | ||
// borderTopColor: theme.borderLightest, | ||
// borderLeftColor: theme.borderLightest, | ||
// borderBottomColor: theme.borderDark, | ||
// borderRightColor: theme.borderDark, | ||
}, | ||
screen: { | ||
flex: 1, | ||
padding: 4, | ||
}, | ||
light: { | ||
position: 'absolute', | ||
right: 20, | ||
top: 140, | ||
width: 10, | ||
borderWidth: 2, | ||
borderTopColor: '#4d9046', | ||
borderBottomColor: '#07ff00', | ||
borderLeftColor: '#4d9046', | ||
borderRightColor: '#07ff00', | ||
}, | ||
stand: { | ||
display: 'flex', | ||
position: 'relative', | ||
alignItems: 'center', | ||
}, | ||
standSegmentOne: { | ||
width: '50%', | ||
height: 14, | ||
borderWidth: 2, | ||
borderColor: 'transparent', | ||
borderTopColor: theme.borderDark, | ||
zIndex: 1, | ||
}, | ||
standSegmentTwo: { | ||
width: '40%', | ||
height: 12, | ||
position: 'relative', | ||
top: -4, | ||
}, | ||
standSegmentThree: { | ||
width: '75%', | ||
height: 8, | ||
position: 'relative', | ||
top: -6, | ||
}, | ||
}); | ||
|
||
export default Desktop; |
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 './Desktop'; |
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