Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Release 0.0.22 (#356)
Browse files Browse the repository at this point in the history
Fixes import bug on [Checkbox]. Move [PinchZoom] and [DatePicker] to packages.

Reorganize `assets` for `main` and `packages`. For packages, it should go inside its root while `main` direct to `__assets` in the same dir.
  • Loading branch information
hyochan authored Oct 2, 2020
1 parent 7645f07 commit 910431a
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 50 deletions.
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dooboo-ui",
"version": "0.0.21",
"version": "0.0.22",
"main": "index.js",
"types": "index.d.ts",
"author": "dooboolab",
Expand Down
5 changes: 2 additions & 3 deletions main/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
useRef,
useState,
} from 'react';

import { GroupCheckboxContext } from './CheckboxGroup';
import { TouchableHighlight } from 'react-native';
import styled from 'styled-components/native';
Expand Down Expand Up @@ -35,7 +36,7 @@ export interface CheckboxProps {
customStyle?: CustomStyle;
}

const Checkbox: FC<CheckboxProps> = ({
export const Checkbox: FC<CheckboxProps> = ({
label,
value,
checked = false,
Expand Down Expand Up @@ -188,5 +189,3 @@ const Label = styled.Text<LabelProps>`
padding-right: ${({ labelLeft }): number => (labelLeft ? 10 : 0)}px;
color: ${({ labelColor }): string => labelColor || COLOR.BLACK};
`;

export default Checkbox;
7 changes: 3 additions & 4 deletions main/Checkbox/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { FC, useCallback, useEffect, useRef, useState } from 'react';
import Checkbox from './Checkbox';

import { Checkbox } from './Checkbox';
import styled from 'styled-components/native';

interface CustomStyle {
Expand Down Expand Up @@ -48,7 +49,7 @@ interface CheckboxGroupProps {

export const GroupCheckboxContext = React.createContext<CheckboxGroupContext | null>(null);

const CheckboxGroup: FC<CheckboxGroupProps> = ({
export const CheckboxGroup: FC<CheckboxGroupProps> = ({
defaultValues,
values,
options,
Expand Down Expand Up @@ -157,5 +158,3 @@ const Container = styled.View<ContainerProps>`
flex-wrap: wrap;
align-items: flex-start;
`;

export default CheckboxGroup;
4 changes: 2 additions & 2 deletions main/Checkbox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as Checkbox } from './Checkbox';
export { default as CheckboxGroup } from './CheckboxGroup';
export { Checkbox } from './Checkbox';
export { CheckboxGroup } from './CheckboxGroup';
File renamed without changes
2 changes: 0 additions & 2 deletions main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ export { SwitchToggle } from './SwitchToggle';
export { Select, SelectItem } from './Select';
export { Checkbox, CheckboxGroup } from './Checkbox';
export { Card } from './Card';
export { PinchZoom } from './PinchZoom';
export { DatePicker } from './DatePicker';
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"react-docgen-typescript-loader": "^3.7.2",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.0.tar.gz",
"react-native-get-random-values": "^1.5.0",
"react-native-svg": "^12.1.0",
"react-native-web": "^0.13.14",
"react-test-renderer": "^16.13.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ViewStyle,
} from 'react-native';
import React, { FC, useEffect, useState } from 'react';

import styled from 'styled-components/native';

const Container = styled.View`
Expand Down Expand Up @@ -139,7 +140,7 @@ const DateInput: FC<Props> = (props) => {
<TouchableOpacity onPress={onPressCalendar}>
<Image
style={{ width: 20, height: 20 }}
source={require('../__assets__/calendar.png')}
source={require('./assets/calendar.png')}
/>
</TouchableOpacity>
</StyledRowContainer>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/Tables/CheckBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { TouchableOpacity } from 'react-native';

import { TouchableOpacity } from 'react-native';
import styled from 'styled-components/native';

const CheckView = styled.View<{ checked: boolean }>`
Expand Down Expand Up @@ -31,7 +31,7 @@ function CheckBox(props: Props): ReactElement {
return (
<TouchableOpacity testID="checkbox-test-id" onPress={onClick}>
<CheckView checked={value}>
<CheckMark source={require('../__assets__/mark.png')} />
<CheckMark source={require('../assets/mark.png')} />
</CheckView>
</TouchableOpacity>
);
Expand Down
Binary file added packages/Tables/assets/mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ const standardDate = new Date('2020-09-13');

describe('[DatePicker] render', () => {
it('should render without crashing', () => {
const rendered = render(<DatePicker selectedDate={standardDate} locale={'en-US'} />).toJSON();
const rendered = render(<DatePicker selectedDate={standardDate} locale={'en-US'} />);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});
});

describe('[DateInput] render', () => {
it('should render without crashing', () => {
const rendered = render(
<DateInput onPressCalendar={(): void => { }} selectedDate={standardDate} />,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});

describe('[DateInput] Interaction', () => {
Expand Down Expand Up @@ -73,10 +71,9 @@ describe('[PickerCalendar] render', () => {
selectedDate={standardDate}
locale={'en-US'}
weekdayFormat={'narrow'} />,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});
});

Expand All @@ -89,21 +86,19 @@ describe('[Calendar]', () => {
calendarWidth={300}
locale={'en-US'}
/>,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});
});

describe('[CalendarDate] render', () => {
it('should render without crashing', () => {
const rendered = render(
<CalendarDate onPress={(): void => { }} date={standardDate} isToday={false} />,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});

describe('[CalendarDate] Interaction', () => {
Expand Down Expand Up @@ -142,20 +137,18 @@ describe('[CalendarMonth] render', () => {
renderDay={(): React.ReactElement => <CalendarDate date={standardDate} isToday={false} />}
today={standardDate}
/>,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});
});

describe('[CalendarWeekDays] render', () => {
it('should render without crashing', () => {
const rendered = render(
<CalendarWeekDays calendarWidth={300} weekdayFormat={'narrow'} locale={'en-US'} />,
).toJSON();
);

expect(rendered).toMatchSnapshot();
expect(rendered).toBeTruthy();
expect(rendered.toJSON()).toMatchSnapshot();
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7287,7 +7287,7 @@ exports[`[DateInput] render should render without crashing 1`] = `
<Image
source={
Object {
"testUri": "../../../main/__assets__/calendar.png",
"testUri": "../../../packages/DatePicker/assets/calendar.png",
}
}
style={
Expand Down Expand Up @@ -7423,7 +7423,7 @@ exports[`[DatePicker] render should render without crashing 1`] = `
<Image
source={
Object {
"testUri": "../../../main/__assets__/calendar.png",
"testUri": "../../../packages/DatePicker/assets/calendar.png",
}
}
style={
Expand Down
20 changes: 10 additions & 10 deletions packages/__tests__/__snapshots__/Tables.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -701,7 +701,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -994,7 +994,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -1287,7 +1287,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -1580,7 +1580,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -1873,7 +1873,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -2166,7 +2166,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -2459,7 +2459,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -2752,7 +2752,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down Expand Up @@ -3045,7 +3045,7 @@ exports[`[Tables] render test should render checkbox when isCheckAble is true 1`
<Image
source={
Object {
"testUri": "../../../packages/Tables/__assets__/mark.png",
"testUri": "../../../packages/Tables/assets/mark.png",
}
}
style={
Expand Down
2 changes: 1 addition & 1 deletion stories/dooboo-ui/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
import { Text, View } from 'react-native';

import { ContainerDeco } from '../../storybook/decorators';
import { DatePicker } from '../../main';
import { DatePicker } from '../../packages/DatePicker';
import { storiesOf } from '@storybook/react-native';
import styled from 'styled-components/native';

Expand Down
3 changes: 2 additions & 1 deletion stories/dooboo-ui/PinchZoom.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Article, ImageList, ImageSlider } from '../../main/PinchZoom/PinchZoom.example';
import { Article, ImageList, ImageSlider } from '../../packages/PinchZoom/PinchZoom.example';

import { ContainerDeco } from '../../storybook/decorators';
import React from 'react';
import { storiesOf } from '@storybook/react-native';
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9257,6 +9257,11 @@ fancy-log@^1.3.2:
parse-node-version "^1.0.0"
time-stamp "^1.0.0"

fast-base64-decode@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz#b434a0dd7d92b12b43f26819300d2dafb83ee418"
integrity sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q==

fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
Expand Down Expand Up @@ -15614,6 +15619,13 @@ react-lifecycles-compat@^3.0.4:
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==

react-native-get-random-values@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.5.0.tgz#91cda18f0e66e3d9d7660ba80c61c914030c1e05"
integrity sha512-LK+Wb8dEimJkd/dub7qziDmr9Tw4chhpzVeQ6JDo4czgfG4VXbptRyOMdu8503RiMF6y9pTH6ZUTkrrpprqT7w==
dependencies:
fast-base64-decode "^1.0.0"

react-native-image-pan-zoom@^2.1.12:
version "2.1.12"
resolved "https://registry.yarnpkg.com/react-native-image-pan-zoom/-/react-native-image-pan-zoom-2.1.12.tgz#eb98bf56fb5610379bdbfdb63219cc1baca98fd2"
Expand Down

0 comments on commit 910431a

Please sign in to comment.