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

Feature/update screen and top bar #138

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions Storybook/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"react-dom": "^18.2.0",
"react-native": "0.72.4",
"react-native-code-push": "^8.1.0",
"react-native-device-info": "^10.12.0",
"react-native-drop-shadow": "^0.0.6",
"react-native-gesture-handler": "^2.12.0",
"react-native-icomoon": "^0.1.1",
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const jestConfig: JestConfigWithTsJest = {
],
moduleDirectories: ['node_modules', 'src'],
setupFiles: [
'./jest.setup.js',
'./node_modules/react-native-gesture-handler/jestSetup.js',
'./node_modules/react-native/jest/setup.js',
],
Expand Down
4 changes: 4 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This 2 following lines are mandatory since we add and use react-native-device-info
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';
// eslint-disable-next-line no-undef
jest.mock('react-native-device-info', () => mockRNDeviceInfo);
1,469 changes: 1,204 additions & 265 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"jest-junit": "^15.0.0",
"pod-install": "^0.1.0",
"prettier": "3.0.3",
"react": "18.2.0",
"react-native": "0.72.6",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
Expand All @@ -75,15 +73,15 @@
"@gorhom/bottom-sheet": "*",
"react": "*",
"react-native": "*",
"react-native-device-info": "*",
"react-native-drop-shadow": "*",
"react-native-gesture-handler": "*",
"react-native-icomoon": "*",
"react-native-linear-gradient": "*",
"react-native-paper": "*",
"react-native-reanimated": "*",
"react-native-safe-area-context": "*",
"react-native-svg": "*",
"react-native-vector-icons": "*",
"react-native-drop-shadow": "*",
"react-native-linear-gradient": "*"
},
"dependencies": {}
"react-native-vector-icons": "*"
}
}
6 changes: 4 additions & 2 deletions src/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { SafeAreaView, ViewStyle, StatusBar, StyleSheet } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTheme } from '../styles/themes';
import DeviceInfo from 'react-native-device-info';
import type { WithTestID } from 'src/shared/type';

type Props = WithTestID<{
Expand All @@ -13,14 +14,15 @@ type Props = WithTestID<{
export const Screen = ({ children, style, testID, statusBarColor }: Props) => {
const theme = useTheme();
const insets = useSafeAreaInsets();
const isTablet = DeviceInfo.isTablet();

const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: theme.sw.colors.neutral[50],
marginTop: insets.top,
paddingLeft: theme.sw.spacing.m,
paddingRight: theme.sw.spacing.m,
paddingLeft: isTablet ? theme.sw.spacing.m : 0,
paddingRight: isTablet ? theme.sw.spacing.m : 0,
...style,
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { StyleSheet, ViewStyle } from 'react-native';

import { Body } from '../typography/Body';
import { ThemType, useTheme } from '../../styles/themes';
import { Theme, useTheme } from '../../styles/themes';
import type { WithTestID } from 'src/shared/type';

type BadgeProps = WithTestID<{
Expand All @@ -11,7 +11,7 @@ type BadgeProps = WithTestID<{
style?: ViewStyle;
}>;

const createStyle = (theme: ThemType, style?: ViewStyle) => {
const createStyle = (theme: Theme, style?: ViewStyle) => {
return StyleSheet.create({
badge: {
backgroundColor: theme.sw.colors.neutral[700],
Expand Down
5 changes: 4 additions & 1 deletion src/components/topAppBar/TopAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Appbar } from 'react-native-paper';
import { useTheme } from '../../styles/themes';
import { StyleSheet, type ViewStyle } from 'react-native';
import { Headline } from '../typography/Headline';
import DeviceInfo from "react-native-device-info";
import type { IconSource } from 'react-native-paper/lib/typescript/components/Icon';
import type { WithTestID } from 'src/shared/type';

Expand Down Expand Up @@ -33,11 +34,13 @@ export const TopAppBar = ({
testID,
}: Props) => {
const theme = useTheme();
const isTablet = DeviceInfo.isTablet();

const styles = StyleSheet.create({
button: {
backgroundColor: 'rgba(145, 158, 171, 0.24)',
borderRadius: 18,
marginLeft: 12,
marginLeft: isTablet ? 12 : theme.sw.spacing.xs,
},
title: {
paddingTop: size === 'medium' ? 9 : 0,
Expand Down
4 changes: 2 additions & 2 deletions src/styles/themes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ const theme = {
},
};

export type ThemType = typeof theme;
export const useTheme = () => usePaperTheme<ThemType>();
export type Theme = typeof theme;
clementdejoie marked this conversation as resolved.
Show resolved Hide resolved
export const useTheme = () => usePaperTheme<Theme>();

type Props = {
children?: ReactNode;
Expand Down
Loading