Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme integration #54

Merged
merged 31 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7541bbd
Merge branch 'master' of github.com:galio-org/galio into theme
hetmann Nov 3, 2018
cf10014
Added theme support, components updated with theme support
hetmann Nov 4, 2018
d2be8b2
theme: export default GalioTheme with Colors & Sizes
hetmann Nov 4, 2018
d70a323
Components updated to include default theme, styles & theme defaultPr…
hetmann Nov 4, 2018
97051b3
theme.js fix issue with theme & styles props
hetmann Nov 5, 2018
a5847e8
Update Text.js
hetmann Nov 5, 2018
ff6b4da
Update Icon.js
hetmann Nov 5, 2018
ca1524d
Update Button.js
hetmann Nov 5, 2018
066e2ee
theme: export withGalio, GalioProvider
hetmann Nov 5, 2018
377e3e6
Update Button.js
hetmann Nov 5, 2018
93a9021
Update sizes.js
hetmann Nov 5, 2018
74225e0
Update index.js
hetmann Nov 6, 2018
ba39fb8
Update sizes.js
hetmann Nov 6, 2018
dd721a2
Update sizes.js
hetmann Nov 6, 2018
68a4809
Update Button.js
hetmann Nov 6, 2018
dfbb461
Update Block.js
hetmann Nov 6, 2018
9b4ebe2
Update Card.js
hetmann Nov 6, 2018
ad3a7d1
Update sizes.js
hetmann Nov 6, 2018
961e3af
Merge branch 'Alpha-1' of github.com:galio-org/galio into theme
hetmann Nov 6, 2018
d752091
theme: updated comments
hetmann Nov 6, 2018
f066893
Update sizes.js
hetmann Nov 6, 2018
5ab6d2b
Update Block.js
hetmann Nov 7, 2018
addac14
Update Button.js
hetmann Nov 7, 2018
cf8c69c
theme: update expo to v31, remove unused packages
hetmann Nov 7, 2018
bbc13d5
theme: cleanup & updates
hetmann Nov 7, 2018
2cf98ce
theme: version minor
hetmann Nov 7, 2018
8c6d65e
Update index.js
hetmann Nov 8, 2018
3f41c16
1.1.1
hetmann Nov 8, 2018
01d42c3
theme: update package version to 1.0.4 instead of mirror 1.1.1
hetmann Nov 9, 2018
96a7469
theme: version started from 0.4.0
hetmann Nov 9, 2018
5ac2371
theme: README for theme, how to use, customise and more...
hetmann Nov 9, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"printWidth": 100,
"tabWidth": 2,
"jsxBracketSameLine": true,
"singleQuote": true,
"trailingComma": "es5",
"proseWrap": "always"
Expand Down
33 changes: 12 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "galio-framework",
"main": "src/index.js",
"version": "1.0.3",
"version": "0.4.0",
"files": [
"src/"
],
Expand All @@ -25,35 +25,26 @@
],
"scripts": {
"precommit": "yarn lint",
"lint": "eslint src/**.js",
"test": "jest"
"lint": "eslint src/**.js"
},
"dependencies": {
"expo": "^29.0.0"
"expo": "^31.0.4"
},
"devDependencies": {
"babel-eslint": "^10.0.0",
"d3-shape": "^1.2.2",
"eslint": "^5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-flowtype": "^2.50.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"prettier": "^1.14.2",
"eslint": "^5.8.0",
"eslint-config-universe": "^1.0.7",
"prettier": "^1.15.1",
"prop-types": "^15.6.2",
"react": "16.3.1",
"react-devtools": "^3.3.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
"react-native-svg": "^7.0.3",
"react-native-svg-charts": "^5.2.0",
"react-native-vector-icons": "^6.0.2",
"react-navigation": "^2.13.0",
"whatwg-fetch": "^2.0.4"
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
"react-native-vector-icons": "^6.0.2"
},
"peerDependencies": {
"react": "*",
"react-native": "*",
"react-native-vector-icons": "*"
},
"eslintConfig": {
"extends": "universe/native"
}
}
147 changes: 76 additions & 71 deletions src/Block.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import React, { Component } from 'react';
import { View, StyleSheet, SafeAreaView } from 'react-native';
import PropTypes from 'prop-types';
import theme from './theme';

export default class Block extends Component {
static defaultProps = {
row: false,
flex: false,
center: false,
middle: false,
top: false,
bottom: false,
right: false,
left: false,
card: false,
shadow: false,
space: null,
fluid: false,
height: null,
width: null,
shadowColor: null,
safe: false,
}
import GalioTheme, { withGalio } from './theme';

class Block extends Component {
render() {
const {
row,
Expand All @@ -43,6 +24,7 @@ export default class Block extends Component {
safe,
children,
style,
styles,
...props
} = this.props;

Expand Down Expand Up @@ -75,19 +57,37 @@ export default class Block extends Component {
}

return (
<View style={styleBlock} {...props}>
<View {...props} style={styleBlock}>
{children}
</View>
);
}
}

Block.defaultProps = {
row: false,
flex: false,
center: false,
middle: false,
top: false,
bottom: false,
right: false,
left: false,
card: false,
shadow: false,
space: null,
fluid: false,
height: null,
width: null,
shadowColor: null,
safe: false,
styles: {},
theme: GalioTheme,
};

Block.propTypes = {
row: PropTypes.bool,
flex: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.number,
]),
flex: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
center: PropTypes.bool,
middle: PropTypes.bool,
top: PropTypes.bool,
Expand All @@ -102,50 +102,55 @@ Block.propTypes = {
width: PropTypes.number,
shadowColor: PropTypes.string,
safe: PropTypes.bool,
styles: PropTypes.any,
theme: PropTypes.any,
};

const styles = StyleSheet.create({
block: {
flexDirection: 'column',
},
row: {
flexDirection: 'row',
},
middle: {
alignItems: 'center',
justifyContent: 'center',
},
center: {
alignItems: 'center',
alignSelf: 'center',
},
left: {
alignItems: 'flex-start',
},
right: {
alignItems: 'flex-end',
},
top: {
alignItems: 'flex-start',
alignSelf: 'flex-start',
},
bottom: {
alignItems: 'flex-end',
alignSelf: 'flex-end',
},
card: {
borderRadius: theme.SIZES.BASE * 0.4,
borderWidth: theme.SIZES.BASE * 0.05,
borderColor: theme.COLORS.BLOCK,
},
shadow: {
shadowColor: theme.COLORS.BLOCK,
shadowOffset: { width: 0, height: 3 },
shadowOpacity: 0.15,
shadowRadius: 8,
elevation: 1,
},
fluid: {
width: 'auto',
},
});
const styles = theme =>
StyleSheet.create({
block: {
flexDirection: 'column',
},
row: {
flexDirection: 'row',
},
middle: {
alignItems: 'center',
justifyContent: 'center',
},
center: {
alignItems: 'center',
alignSelf: 'center',
},
left: {
alignItems: 'flex-start',
},
right: {
alignItems: 'flex-end',
},
top: {
alignItems: 'flex-start',
alignSelf: 'flex-start',
},
bottom: {
alignItems: 'flex-end',
alignSelf: 'flex-end',
},
card: {
borderRadius: theme.SIZES.CARD_BORDER_RADIUS,
borderWidth: theme.SIZES.CARD_BORDER_WIDTH,
borderColor: theme.COLORS.BLOCK,
},
shadow: {
shadowColor: theme.COLORS.BLOCK,
shadowOffset: { width: 0, height: 3 },
shadowOpacity: theme.SIZES.BLOCK_SHADOW_OPACITY,
shadowRadius: theme.SIZES.BLOCK_SHADOW_RADIUS,
elevation: theme.SIZES.ANDROID_ELEVATION,
},
fluid: {
width: 'auto',
},
});

export default withGalio(Block, styles);
Loading