Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/janis-commerce/ui-native
Browse files Browse the repository at this point in the history
…into JUIP-118-corregir-estilos-de-storybook-de-componente-input
  • Loading branch information
pablonortiz committed Aug 18, 2023
2 parents 8a6915f + dfb730a commit 6e78d80
Show file tree
Hide file tree
Showing 24 changed files with 32,975 additions and 42,845 deletions.
1 change: 1 addition & 0 deletions .ondevice/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const getStories = () => {
"./storybook/stories/Image/Image.stories.js": require("../storybook/stories/Image/Image.stories.js"),
"./storybook/stories/Input/Input.stories.js": require("../storybook/stories/Input/Input.stories.js"),
"./storybook/stories/Loading/Loading.stories.js": require("../storybook/stories/Loading/Loading.stories.js"),
"./storybook/stories/LoadingFullScreen/LoadingFullScreen.stories.js": require("../storybook/stories/LoadingFullScreen/LoadingFullScreen.stories.js"),
"./storybook/stories/StatusChip/StatusChip.stories.js": require("../storybook/stories/StatusChip/StatusChip.stories.js"),
"./storybook/stories/Svg/Svg.stories.js": require("../storybook/stories/Svg/Svg.stories.js"),
"./storybook/stories/Text/Text.stories.js": require("../storybook/stories/Text/Text.stories.js"),
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added component Input
- Added readme
- Added github action to deploy storybooks docs
- Added component LoadingFullScreen

### Changed

Expand All @@ -32,7 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed export components
- Fixed an error when locally linking the package with a react native app
- Fixed the error when components are styled using styled-components

### Removed

- Removed standard version package and setup
- Removed Text component inside storybooks folder, and started using it from components
75,239 changes: 32,469 additions & 42,770 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"react-test-renderer": "17.0.2",
"setup-env": "^2.0.0",
"storybook": "^6.5.4",
"webpack": "^5.52.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"webpack": "^5.52.0"
},
"resolutions": {
"@types/react": "^16"
Expand Down
5 changes: 4 additions & 1 deletion src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useState} from 'react';
import {StyleSheet, View} from 'react-native';
import {StyleSheet, View, ViewStyle} from 'react-native';
import Image from '../Image';
import Text from '../Text';
import {formatPlaceholder} from './utils/formatPlaceholder/index';
Expand All @@ -21,6 +21,7 @@ export interface AvatarProps {
customSize?: number;
imageUrl?: string;
onErrorImg?: () => void;
style?: ViewStyle;
}

const styles = StyleSheet.create({
Expand All @@ -45,6 +46,7 @@ const Avatar = ({
placeholder,
customSize,
onErrorImg,
style,
...props
}: AvatarProps) => {
const [showInitials, setShowInitials] = useState(false);
Expand Down Expand Up @@ -72,6 +74,7 @@ const Avatar = ({
height: getSize(size, customSize),
width: getSize(size, customSize),
},
style,
]}
{...props}>
{!!imageUrl && !showInitials && (
Expand Down
6 changes: 4 additions & 2 deletions src/components/CheckBox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {View, TouchableOpacity, StyleSheet} from 'react-native';
import {View, TouchableOpacity, StyleSheet, ViewStyle} from 'react-native';
import {base, grey, primary} from '../../theme/palette';
import Icon from './icon/CheckedIcon';

Expand All @@ -11,6 +11,7 @@ interface CheckBoxProps {
iconCheckColor?: string;
borderRadius?: number;
disabled?: boolean;
style?: ViewStyle;
}

const getCheckBoxScale = (size: number, divisor: number): number => size / divisor;
Expand All @@ -23,6 +24,7 @@ const CheckBox = ({
iconCheckColor = base.white,
borderRadius,
disabled = false,
style,
...props
}: CheckBoxProps) => {
const hasBorderRadius = !borderRadius ? getCheckBoxScale(customSize, 4) : borderRadius;
Expand Down Expand Up @@ -57,7 +59,7 @@ const CheckBox = ({
<TouchableOpacity
disabled={disabled}
activeOpacity={0.6}
style={styles.touchableOpacity}
style={[styles.touchableOpacity, style]}
{...props}>
<View style={isChecked}>{checked && <Icon color={iconCheckColor} size={customSize} />}</View>
</TouchableOpacity>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
View,
Text,
KeyboardType,
TextStyle,
NativeSyntheticEvent,
TextInputEndEditingEventData,
} from 'react-native';
Expand Down Expand Up @@ -44,6 +45,7 @@ interface InputProps {
onSubmitEditing?: () => void;
onFocus?: () => void;
onBlur?: () => void;
style?: TextStyle;
}

const Input = React.forwardRef<TextInput, InputProps>(
Expand All @@ -63,6 +65,7 @@ const Input = React.forwardRef<TextInput, InputProps>(
onSubmitEditing = () => {},
onFocus = () => {},
onBlur = () => {},
style,
...props
}: InputProps,
ref: LegacyRef<TextInput>
Expand Down Expand Up @@ -146,7 +149,7 @@ const Input = React.forwardRef<TextInput, InputProps>(
<View style={styles.inputWrapper}>
{isLabelVisible && <Text style={styles.label}>{label}</Text>}
<TextInput
style={styles.input}
style={[styles.input, style]}
ref={ref}
onFocus={onFocusHandler}
onEndEditing={onEndEditingHandler}
Expand Down
6 changes: 4 additions & 2 deletions src/components/Loading/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useRef, FC} from 'react';
import {StyleSheet, View, Animated, Easing, ColorValue} from 'react-native';
import {StyleSheet, View, Animated, Easing, ColorValue, ViewStyle} from 'react-native';
import {primary, white} from '../../theme/palette';

interface Params {
Expand All @@ -13,6 +13,7 @@ interface Props {
size?: number;
duration?: number;
children?: React.ReactNode | null;
style?: ViewStyle;
}

const startRotationAnimation = ({duration, rotationDegree, timingAnimation}: Params): void =>
Expand All @@ -31,6 +32,7 @@ const Loading: FC<Props> = ({
size = 64,
duration = 1000,
children = null,
style,
...props
}) => {
const rotationDegree = useRef(new Animated.Value(0)).current;
Expand Down Expand Up @@ -81,7 +83,7 @@ const Loading: FC<Props> = ({
}

return (
<View style={styles.container} {...props}>
<View style={[styles.container, style]} {...props}>
<Animated.View style={{...styles.spinner, ...animationSpinnerStyle}} />
{children}
</View>
Expand Down

0 comments on commit 6e78d80

Please sign in to comment.