Skip to content

Commit f0960d6

Browse files
authored
V7 dark shadows (#2472)
* remove dark shadow presets * update screen * formatting
1 parent f86b897 commit f0960d6

File tree

2 files changed

+26
-46
lines changed

2 files changed

+26
-46
lines changed

demo/src/screens/foundationScreens/ShadowsScreen.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@ import React, {Component} from 'react';
33
import {ScrollView, View, Text, StyleSheet, Dimensions} from 'react-native';
44
import {Colors, Shadows} from 'react-native-ui-lib'; // eslint-disable-line
55

6-
76
const {height} = Dimensions.get('window');
87
const SHAPE_DIAMETER = 80;
98

10-
const shadowsOverWhiteBkg = _.reduce(Shadows, (results, value, key) => {
11-
if (key.startsWith('white')) {
12-
results[key] = value;
13-
}
14-
return results;
15-
}, {});
16-
17-
const shadowsOverDarkBkg = _.reduce(Shadows, (results, value, key) => {
18-
if (key.startsWith('dark')) {
19-
results[key] = value;
20-
}
21-
return results;
22-
}, {});
9+
const shadowsOverWhiteBkg = _.reduce(Shadows,
10+
(results, value, key) => {
11+
if (key.startsWith('white')) {
12+
results[key] = value;
13+
}
14+
return results;
15+
},
16+
{});
2317

18+
const shadowsOverGreyBkg = _.reduce(Shadows,
19+
(results, value, key) => {
20+
if (key.startsWith('grey')) {
21+
results[key] = value;
22+
}
23+
return results;
24+
},
25+
{});
2426

2527
export default class ShadowsScreen extends Component {
26-
2728
renderShadows(shadowsList) {
2829
return []
2930
.concat(_.map(shadowsList, (value, key) => this.renderCircleWithShadow(value, key)))
@@ -59,12 +60,8 @@ export default class ShadowsScreen extends Component {
5960
</View>
6061
<ScrollView>
6162
<View style={styles.container}>
62-
<View style={styles.subContainer}>
63-
{this.renderShadows(shadowsOverDarkBkg)}
64-
</View>
65-
<View style={styles.subContainer}>
66-
{this.renderShadows(shadowsOverWhiteBkg)}
67-
</View>
63+
<View style={styles.subContainer}>{this.renderShadows(shadowsOverGreyBkg)}</View>
64+
<View style={styles.subContainer}>{this.renderShadows(shadowsOverWhiteBkg)}</View>
6865
</View>
6966
</ScrollView>
7067
</View>
@@ -76,14 +73,14 @@ const styles = StyleSheet.create({
7673
container: {
7774
flexDirection: 'row',
7875
flex: 1,
79-
justifyContent: 'space-between',
76+
justifyContent: 'space-between'
8077
},
8178
subContainer: {
8279
flex: 1,
8380
flexDirection: 'column',
8481
minHeight: 0.8 * height,
8582
alignItems: 'center',
86-
justifyContent: 'space-between',
83+
justifyContent: 'space-between'
8784
},
8885
shadowCircle: {
8986
width: SHAPE_DIAMETER,
@@ -92,32 +89,32 @@ const styles = StyleSheet.create({
9289
backgroundColor: 'white',
9390
margin: 40,
9491
justifyContent: 'center',
95-
alignItems: 'center',
92+
alignItems: 'center'
9693
},
9794
innerCircle: {
9895
width: SHAPE_DIAMETER,
9996
height: SHAPE_DIAMETER,
10097
borderRadius: SHAPE_DIAMETER / 2,
10198
backgroundColor: 'white',
102-
justifyContent: 'center',
99+
justifyContent: 'center'
103100
},
104101
shadowSquare: {
105102
width: SHAPE_DIAMETER,
106103
height: SHAPE_DIAMETER,
107104
borderRadius: 6,
108105
backgroundColor: 'white',
109106
margin: 40,
110-
justifyContent: 'center',
107+
justifyContent: 'center'
111108
},
112109
innerSquare: {
113110
width: SHAPE_DIAMETER,
114111
height: SHAPE_DIAMETER,
115112
borderRadius: 6,
116113
backgroundColor: 'white',
117-
justifyContent: 'center',
114+
justifyContent: 'center'
118115
},
119116
shadowLabel: {
120117
fontSize: 9,
121-
textAlign: 'center',
122-
},
118+
textAlign: 'center'
119+
}
123120
});

src/style/shadows.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,6 @@ const Shadows = {
8888
top: {shadowColor: Colors.grey10, shadowOpacity: 0.04, shadowRadius: 4.5, shadowOffset: {height: 5, width: 0}},
8989
bottom: {shadowColor: Colors.grey20, shadowOpacity: 0.04, shadowRadius: 9, shadowOffset: {height: 10, width: 0}}
9090
},
91-
// TODO: We should remove dark presets eventually in favor of grey presets (after completing migration properly)
92-
dark10: {
93-
top: {shadowColor: Colors.grey20, shadowOpacity: 0.02, shadowRadius: 13.5},
94-
bottom: {shadowColor: Colors.grey10, shadowOpacity: 0.03, shadowRadius: 2, shadowOffset: {height: 2, width: 0}}
95-
},
96-
dark20: {
97-
top: {shadowColor: Colors.grey20, shadowOpacity: 0.03, shadowRadius: 15},
98-
bottom: {shadowColor: Colors.grey10, shadowOpacity: 0.02, shadowRadius: 3, shadowOffset: {height: 2.5, width: 0}}
99-
},
100-
dark30: {
101-
top: {shadowColor: Colors.grey10, shadowOpacity: 0.04, shadowRadius: 3.5, shadowOffset: {height: 3, width: 0}},
102-
bottom: {shadowColor: Colors.grey20, shadowOpacity: 0.04, shadowRadius: 8, shadowOffset: {height: 7, width: 0}}
103-
},
104-
dark40: {
105-
top: {shadowColor: Colors.grey10, shadowOpacity: 0.04, shadowRadius: 4.5, shadowOffset: {height: 5, width: 0}},
106-
bottom: {shadowColor: Colors.grey20, shadowOpacity: 0.04, shadowRadius: 9, shadowOffset: {height: 10, width: 0}}
107-
},
10891

10992
/**
11093
* Load custom set of shadows

0 commit comments

Comments
 (0)