From 19d72e414b6b61f696c33c9328497c22334317c5 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 17 Sep 2024 17:01:32 +0200 Subject: [PATCH 01/29] refactor: Add displayName to RadioGroup component --- src/components/molecules/Field/RadioGroup.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/molecules/Field/RadioGroup.tsx b/src/components/molecules/Field/RadioGroup.tsx index 5c6615c3..551e623b 100644 --- a/src/components/molecules/Field/RadioGroup.tsx +++ b/src/components/molecules/Field/RadioGroup.tsx @@ -43,3 +43,5 @@ export const RadioGroup = ({ ) } + +RadioGroup.displayName = 'RadioGroup' From 1a7213b8da74dcfc7be03b292cf4fa5d27ef9707 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 17 Sep 2024 17:01:47 +0200 Subject: [PATCH 02/29] refactor: Add displayName to SocialButton component --- src/components/molecules/SocialButtons/SocialButton.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/molecules/SocialButtons/SocialButton.tsx b/src/components/molecules/SocialButtons/SocialButton.tsx index 25715f71..8e43aeb3 100644 --- a/src/components/molecules/SocialButtons/SocialButton.tsx +++ b/src/components/molecules/SocialButtons/SocialButton.tsx @@ -75,3 +75,5 @@ export const SocialButton: FC = ({ type = 'google', ...rest } ) } + +SocialButton.displayName = 'SocialButton' From 635491c2c7b9dac55f0213fbd8e843a5b51aca89 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 17 Sep 2024 17:02:02 +0200 Subject: [PATCH 03/29] refactor: Add displayName to CheckboxButton component --- src/design-system/components/CheckboxButton.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/design-system/components/CheckboxButton.tsx b/src/design-system/components/CheckboxButton.tsx index b8bdcca1..c89077b6 100644 --- a/src/design-system/components/CheckboxButton.tsx +++ b/src/design-system/components/CheckboxButton.tsx @@ -103,3 +103,5 @@ export const CheckboxButton = ({ ) } + +CheckboxButton.displayName = 'CheckboxButton' From e3f1da7bbdd0aaa2a5d69b52cd91595c070948ef Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 17 Sep 2024 17:06:36 +0200 Subject: [PATCH 04/29] refactor: Add displayName to Loader component --- src/design-system/components/Loader.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/design-system/components/Loader.tsx b/src/design-system/components/Loader.tsx index bf32271b..f5cf12db 100644 --- a/src/design-system/components/Loader.tsx +++ b/src/design-system/components/Loader.tsx @@ -55,3 +55,5 @@ export const Loader = ({ type, ...props }: LoaderType): JSX.Element => { return renderLoader } + +Loader.displayName = 'Loader' From 37f0e8b5ee7a4e5b9f4b8601e6ea0e359dd69a51 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Thu, 19 Sep 2024 21:09:33 +0200 Subject: [PATCH 05/29] fix: add proper colors to bubbles loader on dark theme --- src/design-system/components/BubblesLoader.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/design-system/components/BubblesLoader.tsx b/src/design-system/components/BubblesLoader.tsx index e9ba85a6..bdc76493 100644 --- a/src/design-system/components/BubblesLoader.tsx +++ b/src/design-system/components/BubblesLoader.tsx @@ -1,3 +1,4 @@ +import { useTheme } from '@baca/hooks' import { useBubblesLoader } from '@baca/hooks/loaders' import React from 'react' import Animated from 'react-native-reanimated' @@ -9,12 +10,15 @@ export type BubblesLoaderType = { size?: number } -const FullCircle = ({ size = 10, color = 'black' }: BubblesLoaderType): JSX.Element => ( +const FullCircle = ({ size = 10, color }: BubblesLoaderType): JSX.Element => ( ) -export const BubblesLoader = ({ size = 40, color = 'black' }: BubblesLoaderType): JSX.Element => { +export const BubblesLoader = ({ size = 40, color }: BubblesLoaderType): JSX.Element => { const { animatedHeight, animatedRotate, animatedWidth } = useBubblesLoader() + const theme = useTheme() + + const loaderColor = color || theme.colors.text.primary const containerStyle = { width: size, @@ -37,12 +41,12 @@ export const BubblesLoader = ({ size = 40, color = 'black' }: BubblesLoaderType) return ( - - + + - - + + ) From 6835da416be981acb4aeca02b98297c06ef1ac6e Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Thu, 19 Sep 2024 21:09:52 +0200 Subject: [PATCH 06/29] fix: add proper colors to circles loader on dark theme --- src/design-system/components/CircleLoader.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/design-system/components/CircleLoader.tsx b/src/design-system/components/CircleLoader.tsx index 3836dcb0..2fd53a9b 100644 --- a/src/design-system/components/CircleLoader.tsx +++ b/src/design-system/components/CircleLoader.tsx @@ -1,3 +1,4 @@ +import { useTheme } from '@baca/hooks' import { useCircleLoader } from '@baca/hooks/loaders' import React from 'react' import Animated, { @@ -102,9 +103,10 @@ const HalfCircle = ({ export const CircleLoader = ({ size = 32, thickness = 2, - color = 'black', + color, }: CircleLoaderType): JSX.Element => { const { animatedRotate, progress } = useCircleLoader() + const theme = useTheme() const fullCircleStyle = { width: size, @@ -114,7 +116,7 @@ export const CircleLoader = ({ } as const const circleStyleProps = { - color, + color: color || theme.colors.text.primary, size, thickness, } From d668b843e2e7d1820bce79c4a9aeafce858cc6db Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Thu, 19 Sep 2024 21:10:16 +0200 Subject: [PATCH 07/29] chore: add RenderComponentWithExample --- .../components/RenderComponentWithExample.tsx | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 src/design-system/components/RenderComponentWithExample.tsx diff --git a/src/design-system/components/RenderComponentWithExample.tsx b/src/design-system/components/RenderComponentWithExample.tsx new file mode 100644 index 00000000..62527090 --- /dev/null +++ b/src/design-system/components/RenderComponentWithExample.tsx @@ -0,0 +1,139 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { Box } from '@baca/design-system/components/Box' +import { Center } from '@baca/design-system/components/Center' +import { Icon } from '@baca/design-system/components/Icon' +import { Row } from '@baca/design-system/components/Row' +import { Text } from '@baca/design-system/components/Text' +import { Touchable } from '@baca/design-system/components/Touchables' +import { useWeb } from '@baca/hooks' +import { showSuccessToast } from '@baca/utils' +import * as Clipboard from 'expo-clipboard' + +const RenderExample = ({ + Component, + ComponentWithProps, +}: { + Component: React.FC | React.ForwardRefExoticComponent | string + ComponentWithProps?: JSX.Element +}) => { + const componentName = + typeof Component === 'string' + ? Component + : Component.displayName || Component.name || 'Component' + + const componentProps = ComponentWithProps?.props || {} + + // Function to generate props as string + const generatePropsString = (props: Record) => { + return Object.entries(props) + .filter(([key]) => key !== 'children') // Exclude 'children' from props + .map(([key, value]) => { + if (typeof value === 'string') { + // Check if value is a code expression (e.g., starts with 't(') + if (/^\s*t\(.+\)\s*$/.test(value)) { + return `\n ${key}={${value}}` + } else { + return `\n ${key}="${value}"` + } + } + if (typeof value === 'function') { + return `\n ${key}={() => {}}` + } + + return `\n ${key}={${JSON.stringify(value)}}` + }) + .join('') + } + + const propsString = generatePropsString(componentProps) + + // Handle children + const hasChildren = 'children' in componentProps + const childrenContent = componentProps.children + + let componentExample = '' + + if (hasChildren) { + if (propsString) { + componentExample = `<${componentName}${propsString} + > + ${childrenContent} + ` + } else { + componentExample = `<${componentName}> + ${childrenContent} + ` + } + } else { + if (propsString) { + componentExample = `<${componentName}${propsString} + />` + } else { + componentExample = `<${componentName} />` + } + } + + // Function to handle copying code to clipboard + const handleCopyCode = () => { + Clipboard.setStringAsync(componentExample) + // Optionally, display a confirmation to the user + + showSuccessToast({ + title: 'Code copied to clipboard!', + description: 'You can paste it in your code editor now.', + }) + } + + return ( + + + tsx + + + Copy Code + + + + {componentExample} + + + ) +} + +export const RenderComponentWithExample = ({ + Component, + ComponentWithProps, +}: { + Component: React.FC | React.ForwardRefExoticComponent | string + ComponentWithProps?: JSX.Element +}) => { + const { shouldApplyMobileStyles } = useWeb() + + return ( + +
+ {ComponentWithProps} +
+ + {/* Show only on tablet and web */} + {!shouldApplyMobileStyles && ( + + )} +
+ ) +} From a9835d055be782da0fcd61e0590b322f563374c8 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Fri, 20 Sep 2024 20:55:51 +0200 Subject: [PATCH 08/29] refactor: Add displayName to Box component --- src/design-system/components/Box.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/design-system/components/Box.tsx b/src/design-system/components/Box.tsx index a66fb2c6..538f96ff 100644 --- a/src/design-system/components/Box.tsx +++ b/src/design-system/components/Box.tsx @@ -7,3 +7,5 @@ import { generateStyledComponent } from '../utils/generateStyledComponent' export type BoxProps = StyledProps & ViewProps export const Box = memo(generateStyledComponent(View)) + +Box.displayName = 'Box' From ae2e22304c595739cc38cee936de84b653ae342a Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Fri, 20 Sep 2024 20:56:17 +0200 Subject: [PATCH 09/29] refactor: Add displayName to Button component and its variants --- .../components/Button/Button.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/design-system/components/Button/Button.tsx b/src/design-system/components/Button/Button.tsx index ab5b7451..34cce16a 100644 --- a/src/design-system/components/Button/Button.tsx +++ b/src/design-system/components/Button/Button.tsx @@ -329,19 +329,42 @@ const Button = generateStyledComponent( RawButton ) as ButtonComposition +Button.displayName = 'Button' + const generateButtonVariant = (variant: ButtonVariant) => forwardRef((props, ref) => - - - + + } + /> + + + } + /> + + } + /> + + } + /> + + } + /> + + + } + /> + + } + /> + + + } + /> + + } + /> + + } + /> + + } + /> + + } + /> + {t('components_screen.button_variants.disabled')} + } + /> + } + /> + + } + /> + } + /> + } + /> + - - - - - + + + + UI Examples + + + + + Navigation + - - - {/* TODO: Add translations */} - - + ) } From 223fea60b18e32e75059f3dead55681948b21639 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Mon, 23 Sep 2024 09:21:57 +0200 Subject: [PATCH 27/29] refactor: Improve image rendering in LandingScreen --- src/screens/LandingScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/LandingScreen.tsx b/src/screens/LandingScreen.tsx index 52f5b661..4b60c723 100644 --- a/src/screens/LandingScreen.tsx +++ b/src/screens/LandingScreen.tsx @@ -45,7 +45,7 @@ export const LandingScreen = () => { }, [screenWidth]) const renderItem = (item: ImageSourcePropType, index: number) => ( - + @@ -59,7 +59,7 @@ export const LandingScreen = () => { return ( -
+
{t('home_screen.header_title')} From a1e00333c5ba149bdba8d67e4d1d830054061394 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 24 Sep 2024 19:50:07 +0200 Subject: [PATCH 28/29] refactor: use makeBigerOnHover function instead using specific styles --- .../tabNavigator/components/SideBarTabItem.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/navigation/tabNavigator/components/SideBarTabItem.tsx b/src/navigation/tabNavigator/components/SideBarTabItem.tsx index fde2f692..13d6e6e8 100644 --- a/src/navigation/tabNavigator/components/SideBarTabItem.tsx +++ b/src/navigation/tabNavigator/components/SideBarTabItem.tsx @@ -1,6 +1,7 @@ import { Icon, Row, Text } from '@baca/design-system' import { IconNames } from '@baca/types' -import { Platform, StyleSheet } from 'react-native' +import { makeBigerOnHover } from '@baca/utils/webStyling' +import { StyleSheet } from 'react-native' import { TabBarItemWrapper } from './TabBarItemWrapper' import { useUniversalWidth } from '../hooks' @@ -32,18 +33,7 @@ export function SideBarTabItem({ p={2} gap={4} bg={hovered ? 'bg.tertiary' : undefined} - style={[ - Platform.select({ - web: { - transitionDuration: '200ms', - transitionProperty: ['background-color', 'box-shadow', 'transform'], - transitionTimingFunction: 'cubic-bezier(0.17, 0.17, 0, 1)', - }, - }), - hovered && { - transform: [{ scale: 1.1 }], - }, - ]} + style={makeBigerOnHover(hovered)} > {isLarge ? ( From 394fe4cbdc22190bda1e6dd21a941542536411e7 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 24 Sep 2024 19:50:35 +0200 Subject: [PATCH 29/29] chore: add extra padding to header container on big screens --- src/styles/root-layout.module.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/styles/root-layout.module.scss b/src/styles/root-layout.module.scss index 1906f0df..44729550 100644 --- a/src/styles/root-layout.module.scss +++ b/src/styles/root-layout.module.scss @@ -15,6 +15,9 @@ $ui-sidebar: 244px; // Header Logo .headerContainer { padding-top: 0px; + @media (min-width: $size-l) { + padding: 8px; + } } .headerLogo {