Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Piekarczyk committed May 21, 2021
1 parent 750b1af commit df956e5
Show file tree
Hide file tree
Showing 43 changed files with 2,511 additions and 1,408 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ example/web-build
completed.json
errors.json
components.json

js.map
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ Release Process:
- We release master, meaning a pull-request containing substantive changes
should not alter any version information.

- When master is ready for release, create a new branch and run a `yarn
version:XXXX` command from the root, as appropriate. Lerna will update all
- When master is ready for release, create a new branch and run a `yarn version:XXXX` command from the root, as appropriate. Lerna will update all
the package.json files with the next version, and create and tag a commit.

- **NOTE:** We follow a modified semver: EXPO_VERSION.MAJOR.MINOR.
Expand All @@ -90,9 +89,10 @@ Sound cool? [We're hiring!](https://draftbit.com/jobs).

MIT


## Contributing

- Any color should be passed down via theme prop:

```
// NOT dotColor="#5a45ff" b/c that isn't theme powered
// Learn more here https://callstack.github.io/react-native-paper/theming.html
Expand Down
10 changes: 2 additions & 8 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
"description": "Example app for @draftbit/ui",
"privacy": "public",
"version": "1.0.0",
"platforms": [
"ios",
"android",
"web"
],
"platforms": ["ios", "android", "web"],
"icon": "./src/assets/images/icon.png",
"splash": {
"image": "./src/assets/images/splash.png",
Expand All @@ -21,8 +17,6 @@
"ios": {
"supportsTablet": true
},
"assetBundlePatterns": [
"**/*"
]
"assetBundlePatterns": ["**/*"]
}
}
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ const ROUTES = {
};

let customFonts = {
"FiraCode": require("./assets/fonts/FiraCode-Bold.otf"),
"Testing": require("./assets/fonts/Sriracha-Regular.ttf"),
FiraCode: require("./assets/fonts/FiraCode-Bold.otf"),
Testing: require("./assets/fonts/Sriracha-Regular.ttf"),
"Inter-SemiBoldItalic":
"https://rsms.me/inter/font-files/Inter-SemiBoldItalic.otf?v=3.12",
};
Expand Down
21 changes: 9 additions & 12 deletions example/src/FABExample.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from "react";
import {View} from 'react-native'
import {withTheme, FAB} from "@draftbit/ui";
import Section, {Container, styles} from "./Section";
import { View } from "react-native";
import { withTheme, FAB } from "@draftbit/ui";
import Section, { Container, styles } from "./Section";

function FABExample({theme}) {
function FABExample({ theme }) {
// const [elevation, setElevation] = React.useState(0);

const handlePress = () => {};
return (
<Container style={{flexDirection: 'row', backgroundColor: theme.colors.background}}>
<Container
style={{ flexDirection: "row", backgroundColor: theme.colors.background }}
>
<FAB icon="add" onPress={handlePress} />
<FAB icon="add" disabled onPress={handlePress} />
<View style={{backgroundColor: 'yellow'}}>
<FAB
icon="add"
loading
onPress={handlePress}
style={{margin: 20}}
/>
<View style={{ backgroundColor: "yellow" }}>
<FAB icon="add" loading onPress={handlePress} style={{ margin: 20 }} />
</View>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion mock-backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@
"id": 50
}
]
}
}
27 changes: 26 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"bootstrap": "lerna bootstrap",
"crosslink": "lerna link",
"build": "lerna run prepare",
"format": "prettier --write .",
"upload:run": "node ./scripts/collector.js",
"upload:test": "bash ./scripts/test-collector.bash",
"version:expo": "lerna version major --no-push",
Expand All @@ -28,13 +29,37 @@
]
},
"devDependencies": {
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.23",
"babel-jest": "^26.6.3",
"dotenv": "^9.0.2",
"eslint": "^7.26.0",
"expo-yarn-workspaces": "1.2.1",
"jest": "^26.6.3",
"json-server": "^0.16.3",
"lerna": "^4.0.0",
"node-fetch": "^2.6.1",
"prettier": "^2.3.0",
"rimraf": "^3.0.2",
"typescript": "^4.2.4",
"utility-types": "^3.10.0"
}
},
"eslintConfig": {
"extends": [
"@react-native-community",
"prettier"
],
"settings": {
"react": {
"version": "16"
}
}
},
"eslintIgnore": [
"scripts",
"example/web-build",
"node_modules/",
"lib/",
"__generated__"
]
}
68 changes: 0 additions & 68 deletions packages/core/src/components/Avatar.tsx

This file was deleted.

8 changes: 5 additions & 3 deletions packages/core/src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ const Card: React.FC<Props> = ({
// Necessary to inject web-renderable Icons in buider.
const SelectedIcon = IconOverride || Icon;

const { backgroundColor: bgColor, padding, ...styles } = StyleSheet.flatten(
style || {}
);
const {
backgroundColor: bgColor,
padding,
...styles
} = StyleSheet.flatten(style || {});

const backgroundColor = bgColor ? bgColor : theme.colors.surface;
const innerPadding = padding ? padding : 12;
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import dateFormat from "dateformat";
import { withTheme } from "../../theming";

import Portal from "../Portal/Portal";
import Button from "../Button";
import Button from "../DeprecatedButton";
import TextField, { Props as TextFieldProps } from "../TextField";
import Touchable from "../Touchable";
import theme from "../../styles/DefaultTheme";
import DateTimePicker from "./DatePickerComponent";
import type { IconSlot } from "../../interfaces/Icon";

type Props = {
style?: StyleProp<ViewStyle>;
Expand All @@ -27,8 +26,7 @@ type Props = {
onDateChange?: (data?: any) => void;
disabled?: boolean;
mode?: "date" | "time" | "datetime";
} & TextFieldProps &
IconSlot;
} & TextFieldProps;

const MONTHS = [
"January",
Expand All @@ -46,7 +44,6 @@ const MONTHS = [
];

const DatePicker: React.FC<Props> = ({
Icon,
style,
theme: { colors },
date = new Date(),
Expand Down Expand Up @@ -120,7 +117,6 @@ const DatePicker: React.FC<Props> = ({
>
{Platform.OS === "ios" && (
<Button
Icon={Icon}
type="text"
onPress={toggleVisibility}
style={styles.closeButton}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/Elevation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
} from "react-native";
import shadow from "../styles/shadow";
import { withTheme } from "../theming";
import themeT from "../styles/DefaultTheme";
import type { Theme } from "../styles/DefaultTheme";

type Props = {
style?: StyleProp<ViewStyle>;
theme: typeof themeT;
theme: Theme;
} & ViewProps;

/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
Expand Down
12 changes: 5 additions & 7 deletions packages/core/src/components/FAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
Platform,
} from "react-native";
import { withTheme } from "../theming";
import { Icon } from "@draftbit/native";
import type { Theme } from "../styles/DefaultTheme";
import type { IconSlot } from "../interfaces/Icon";

import {
COMPONENT_TYPES,
Expand All @@ -29,9 +29,9 @@ type Props = {
iconName?: string;
onPress: () => void;
theme: Theme;
IconOverride: typeof Icon;
style?: StyleProp<ViewStyle>;
} & PressableProps;
} & PressableProps &
IconSlot;

const FAB: React.FC<Props> = ({
onPress,
Expand All @@ -43,11 +43,9 @@ const FAB: React.FC<Props> = ({
iconColor,
bgColor,
size = 50,
IconOverride = null,
Icon,
...props
}) => {
const SelectedIcon = IconOverride || Icon;

const backgroundColor = bgColor || theme.colors.primary;
const color = iconColor || "#FFF";

Expand Down Expand Up @@ -88,7 +86,7 @@ const FAB: React.FC<Props> = ({
{loading ? (
<ActivityIndicator size="small" color={color} />
) : (
<SelectedIcon name={iconName} size={28} color={iconColor} />
<Icon name={iconName} size={28} color={iconColor} />
)}
</View>
</Pressable>
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/components/FieldRadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import { withTheme } from "../theming";
import Touchable from "./Touchable";
import RadioButton from "./RadioButton/RadioButton";

import { GROUPS, COMPONENT_TYPES, FORM_TYPES } from "@draftbit/types";
import {
GROUPS,
COMPONENT_TYPES,
FORM_TYPES,
colorTypes,
} from "@draftbit/types";
import type { Theme } from "../styles/DefaultTheme";
import { colorTypes } from "../types";

type Props = {
onPress?: () => void;
Expand Down
Loading

0 comments on commit df956e5

Please sign in to comment.