Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit f3f3435

Browse files
committed
added card to readme
1 parent 5c63e4c commit f3f3435

File tree

4 files changed

+47
-25
lines changed

4 files changed

+47
-25
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,17 @@
8181
| iconStyle | none | object | extra styling for icon component ([React Native Vector Icons](https://github.com/oblador/react-native-vector-icons)) |
8282
| style | none | object | button styling |
8383
| iconColor | white | string | icon color |
84-
| title | none | string | title if made into a button |
84+
| title | none | string | title if made into a button |
85+
86+
## Card
87+
88+
![Card Component](http://i.imgur.com/7kiWw5I.png)
89+
90+
```
91+
<Card
92+
title='CARD WITH DIVIDER'>
93+
{
94+
users.map((u, i) => {}
95+
}
96+
</Card>
97+
```

src/about/About.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ class About extends Component {
4646
<Text style={styles.heading}>Components</Text>
4747
</View>
4848
<View style={styles.container}>
49-
<Card>
50-
<Text style={styles.cardTitle}>CARD WITH DIVIDER</Text>
51-
<Divider style={styles.divider} />
49+
<Card
50+
title='CARD WITH DIVIDER'>
5251
{
5352
users.map((u, i) => {
5453
return (
@@ -63,18 +62,16 @@ class About extends Component {
6362
})
6463
}
6564
</Card>
66-
<Card containerStyle={{marginTop: 15}}>
67-
<Text style={styles.cardTitle}>FONTS</Text>
68-
<Divider style={styles.divider} />
65+
<Card containerStyle={{marginTop: 15}} title='FONTS'>
6966
<Text style={styles.fonts} h1>h1 Heading</Text>
7067
<Text style={styles.fonts} h2>h2 Heading</Text>
7168
<Text style={styles.fonts} h3>h3 Heading</Text>
7269
<Text style={styles.fonts} h4>h4 Heading</Text>
7370
<Text style={styles.fonts} >Normal Text</Text>
7471
</Card>
75-
<Card containerStyle={{marginTop: 15}}>
76-
<Text style={styles.cardTitle}>Social Icons</Text>
77-
<Divider style={styles.divider} />
72+
<Card
73+
title='SOCIAL ICONS'
74+
containerStyle={{marginTop: 15}}>
7875
<View style={styles.social}>
7976
<SocialIcon
8077
type='facebook'
@@ -93,9 +90,9 @@ class About extends Component {
9390
/>
9491
</View>
9592
</Card>
96-
<Card containerStyle={{marginTop: 15}}>
97-
<Text style={styles.cardTitle}>Social Buttons</Text>
98-
<Divider style={styles.divider} />
93+
<Card
94+
containerStyle={{marginTop: 15}}
95+
title='SOCIAL BUTTONS'>
9996
<View style={styles.socialButtons}>
10097
<SocialIcon
10198
title='Sign In With Facebook'
@@ -129,8 +126,7 @@ class About extends Component {
129126

130127
styles = StyleSheet.create({
131128
container: {
132-
flex: 1,
133-
margin: 15
129+
flex: 1
134130
},
135131
headerContainer: {
136132
marginTop: 60,
@@ -147,14 +143,6 @@ styles = StyleSheet.create({
147143
fonts: {
148144
marginBottom: 8
149145
},
150-
divider: {
151-
marginBottom: 15
152-
},
153-
cardTitle: {
154-
fontFamily: fonts.ios.bold,
155-
textAlign: 'center',
156-
marginBottom: 15
157-
},
158146
user: {
159147
flexDirection: 'row',
160148
marginBottom: 6

src/components/containers/Card.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44

55
import React from 'react'
66
import { View, StyleSheet, Platform } from 'react-native'
7+
import fonts from 'HSFonts'
78
import colors from 'HSColors'
9+
import Text from 'HSText'
10+
import Divider from 'HSDivider'
811
let styles = {}
912

10-
const Card = ({children, flexDirection, containerStyle, wrapperStyle}) => (
13+
const Card = ({children, flexDirection, containerStyle, wrapperStyle, title, titleStyle, dividerStyle}) => (
1114
<View style={[styles.container, containerStyle && containerStyle]}>
1215
<View style={[styles.wrapper, wrapperStyle && wrapperStyle, flexDirection && {flexDirection}]}>
16+
{
17+
title && (
18+
<View>
19+
<Text style={[styles.cardTitle, titleStyle && titleStyle]}>{title}</Text>
20+
<Divider style={[styles.divider, dividerStyle && dividerStyle]} />
21+
</View>
22+
)
23+
}
1324
{children}
1425
</View>
1526
</View>
@@ -22,6 +33,8 @@ styles = StyleSheet.create({
2233
borderWidth: 1,
2334
borderRadius: 3,
2435
padding: 15,
36+
margin: 15,
37+
marginBottom: 0,
2538
...Platform.select({
2639
ios: {
2740
shadowColor: 'rgba(0,0,0, .2)',
@@ -36,6 +49,14 @@ styles = StyleSheet.create({
3649
},
3750
wrapper: {
3851
backgroundColor: 'transparent'
52+
},
53+
divider: {
54+
marginBottom: 15
55+
},
56+
cardTitle: {
57+
fontFamily: fonts.ios.bold,
58+
textAlign: 'center',
59+
marginBottom: 15
3960
}
4061
})
4162

src/components/social/SocialIcon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const colors = {
1414
twitter: '#00aced',
1515
['google-plus-official']: '#dd4b39',
1616
pinterest: '#cb2027',
17-
linkedIn: '#007bb6',
17+
linkedin: '#007bb6',
1818
youtube: '#bb0000',
1919
vimeo: '#aad450',
2020
tumblr: '#32506d',

0 commit comments

Comments
 (0)