Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
19d72e4
refactor: Add displayName to RadioGroup component
MateuszRostkowski Sep 17, 2024
1a7213b
refactor: Add displayName to SocialButton component
MateuszRostkowski Sep 17, 2024
635491c
refactor: Add displayName to CheckboxButton component
MateuszRostkowski Sep 17, 2024
e3f1da7
refactor: Add displayName to Loader component
MateuszRostkowski Sep 17, 2024
37f0e8b
fix: add proper colors to bubbles loader on dark theme
MateuszRostkowski Sep 19, 2024
6835da4
fix: add proper colors to circles loader on dark theme
MateuszRostkowski Sep 19, 2024
d668b84
chore: add RenderComponentWithExample
MateuszRostkowski Sep 19, 2024
a9835d0
refactor: Add displayName to Box component
MateuszRostkowski Sep 20, 2024
ae2e223
refactor: Add displayName to Button component and its variants
MateuszRostkowski Sep 20, 2024
7d3d02b
refactor: Add displayName to Text and Display components and their va…
MateuszRostkowski Sep 20, 2024
de182f2
chore: add theme switcher button component
MateuszRostkowski Sep 20, 2024
9ba64cf
refactor: change UI components in app loading
MateuszRostkowski Sep 21, 2024
b930424
feat: add theme swticher to app header
MateuszRostkowski Sep 21, 2024
2893245
chore: improve RenderComponentWithExample styles
MateuszRostkowski Sep 21, 2024
4218b14
chore: add makeBiggerOnHover util
MateuszRostkowski Sep 21, 2024
92730b1
feat: open landing screen when pressing on company logo
MateuszRostkowski Sep 21, 2024
03896ca
chore: add theme switcher to signin screen
MateuszRostkowski Sep 21, 2024
81ec0d6
chore: add animations to theme switcher button
MateuszRostkowski Sep 21, 2024
f5afe08
chore: fix background color to generate bg style when passing wrong c…
MateuszRostkowski Sep 21, 2024
2604519
fix: properly ommit props in RenderComponentWithExample
MateuszRostkowski Sep 22, 2024
51be1ad
refactor: remove unnecessary return statement in getColorValue
MateuszRostkowski Sep 22, 2024
67ea7a8
refactor: use makeBigerOnHover function instead using specific styles
MateuszRostkowski Sep 22, 2024
3c93db2
refactor: Improve color rendering in ColorsScreen component
MateuszRostkowski Sep 22, 2024
0065379
refactor: Improve rendering of components in ComponentsScreen
MateuszRostkowski Sep 22, 2024
af2df5b
refactor: Improve rendering of components in TypographyScreen
MateuszRostkowski Sep 23, 2024
cd3df7a
refactor: split examples screen to sections
MateuszRostkowski Sep 23, 2024
223fea6
refactor: Improve image rendering in LandingScreen
MateuszRostkowski Sep 23, 2024
a1e0033
refactor: use makeBigerOnHover function instead using specific styles
MateuszRostkowski Sep 24, 2024
394fe4c
chore: add extra padding to header container on big screens
MateuszRostkowski Sep 24, 2024
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
19 changes: 4 additions & 15 deletions src/components/AppLoading.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Loader, Center } from '@baca/design-system/components'
import { useCachedResources, useNavigationTheme } from '@baca/hooks'
import { Loader, Center, Box } from '@baca/design-system/components'
import { useCachedResources } from '@baca/hooks'
import { useCheckForAppUpdate } from '@baca/hooks/useCheckForAppUpdate'
import { isSignedInAtom } from '@baca/store/auth'
import * as SplashScreen from 'expo-splash-screen'
import { useAtomValue } from 'jotai'
import { FC, PropsWithChildren, useCallback, useEffect, useState } from 'react'
import { View, StyleSheet } from 'react-native'

// Keep the splash screen visible while we fetch resources
SplashScreen.preventAutoHideAsync()

export const AppLoading: FC<PropsWithChildren> = ({ children }) => {
const { navigationTheme } = useNavigationTheme()
const isLoadingComplete = useCachedResources()
const isSignedIn = useAtomValue(isSignedInAtom)

Expand All @@ -38,23 +36,14 @@ export const AppLoading: FC<PropsWithChildren> = ({ children }) => {
}, [isLoading])

return (
<View
{...{ onLayout }}
style={[styles.container, { backgroundColor: navigationTheme.colors.background }]}
>
<Box {...{ onLayout }} flex={1}>
{!isSplashHidden ? (
<Center bg="bg.primary" flexGrow={1}>
<Loader type="bubbles" />
</Center>
) : (
children
)}
</View>
</Box>
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
})
32 changes: 31 additions & 1 deletion src/components/CompanyLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { darkBinarLogo, darkLogoSygnet, lightBinarLogo, lightLogoSygnet } from '@baca/constants'
import { ColorSchemeName, useColorScheme } from '@baca/contexts'
import { Image, ImageStyle, ImageProps } from 'expo-image'
import { Link } from 'expo-router'
import { Platform, StyleSheet } from 'react-native'

type LogoTypes = 'binarSygnet' | 'binar'

Expand All @@ -16,15 +18,43 @@ export const CompanyLogo = ({
type = 'binar',
width = '100%',
style,
asImage = false,
}: {
height?: ImageStyle['height']
type?: LogoTypes
width?: ImageStyle['width']
style?: ImageStyle
asImage?: boolean
}) => {
const { colorScheme } = useColorScheme()

const source = LOGO[colorScheme][type]

return <Image contentFit="scale-down" source={source} style={[{ height, width }, style]} />
if (Platform.OS !== 'web' || asImage) {
return <Image contentFit="scale-down" source={source} style={[{ height, width }, style]} />
}

return (
<Link
href="/"
style={[
{
height,
width,
},
styles.image,
]}
>
<Image contentFit="scale-down" source={source} style={[{ height, width }, style]} />
</Link>
)
}

const styles = StyleSheet.create({
image: {
alignItems: 'center',
display: 'flex',
// flex: 1,
justifyContent: 'center',
},
})
42 changes: 42 additions & 0 deletions src/components/ThemeSwitcherButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useColorScheme } from '@baca/contexts'
import { Icon } from '@baca/design-system'
import { useTheme } from '@baca/hooks'
import { MotiPressable } from 'moti/interactions'
import { useCallback } from 'react'
import { StyleSheet } from 'react-native'

export const ThemeSwitcherButton = () => {
const { setColorSchemeSetting, colorSchemeSetting } = useColorScheme()
const { colors } = useTheme()

const handleColorSchemeSettingChange = useCallback(() => {
const scheme = colorSchemeSetting === 'light' ? 'dark' : 'light'
setColorSchemeSetting(scheme)
}, [colorSchemeSetting, setColorSchemeSetting])

const icon = colorSchemeSetting === 'light' ? 'moon-line' : 'sun-line'

return (
<MotiPressable
onPress={handleColorSchemeSettingChange}
style={styles.iconContainter}
animate={({ hovered }) => {
'worklet'

return {
scale: hovered ? 1.1 : 1,
backgroundColor: hovered ? colors.bg.tertiary : 'transparent',
}
}}
>
<Icon name={icon} size={24} color="text.primary" />
</MotiPressable>
)
}

const styles = StyleSheet.create({
iconContainter: {
borderRadius: 8,
padding: 8,
},
})
2 changes: 2 additions & 0 deletions src/components/molecules/Field/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ export const RadioGroup = <T extends string>({
</Box>
)
}

RadioGroup.displayName = 'RadioGroup'
2 changes: 2 additions & 0 deletions src/components/molecules/SocialButtons/SocialButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ export const SocialButton: FC<SocialButtonProps> = ({ type = 'google', ...rest }
</Button>
)
}

SocialButton.displayName = 'SocialButton'
2 changes: 2 additions & 0 deletions src/design-system/components/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ import { generateStyledComponent } from '../utils/generateStyledComponent'
export type BoxProps = StyledProps & ViewProps

export const Box = memo(generateStyledComponent<BoxProps, View>(View))

Box.displayName = 'Box'
16 changes: 10 additions & 6 deletions src/design-system/components/BubblesLoader.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 => (
<Box style={{ backgroundColor: color, borderRadius: size / 2, width: size, height: size }} />
)

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,
Expand All @@ -37,12 +41,12 @@ export const BubblesLoader = ({ size = 40, color = 'black' }: BubblesLoaderType)
return (
<Animated.View style={[containerStyle, animatedRotate]}>
<Animated.View style={[rowStyle, animatedWidth]}>
<FullCircle color={color} />
<FullCircle color={color} />
<FullCircle color={loaderColor} />
<FullCircle color={loaderColor} />
</Animated.View>
<Animated.View style={[absoluteStyle, animatedHeight]}>
<FullCircle color={color} />
<FullCircle color={color} />
<FullCircle color={loaderColor} />
<FullCircle color={loaderColor} />
</Animated.View>
</Animated.View>
)
Expand Down
23 changes: 23 additions & 0 deletions src/design-system/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,19 +329,42 @@ const Button = generateStyledComponent<ButtonProps, typeof Pressable>(
RawButton
) as ButtonComposition

Button.displayName = 'Button'

const generateButtonVariant = (variant: ButtonVariant) =>
forwardRef<View, ButtonProps>((props, ref) => <Button {...{ ...props, ref, variant }} />)

Button.Primary = generateButtonVariant('Primary')
Button.Primary.displayName = 'Button.Primary'

Button.PrimaryDestructive = generateButtonVariant('PrimaryDestructive')
Button.PrimaryDestructive.displayName = 'Button.PrimaryDestructive'

Button.SecondaryColor = generateButtonVariant('SecondaryColor')
Button.SecondaryColor.displayName = 'Button.SecondaryColor'

Button.SecondaryGray = generateButtonVariant('SecondaryGray')
Button.SecondaryGray.displayName = 'Button.SecondaryGray'

Button.SecondaryDestructive = generateButtonVariant('SecondaryDestructive')
Button.SecondaryDestructive.displayName = 'Button.SecondaryDestructive'

Button.TertiaryColor = generateButtonVariant('TertiaryColor')
Button.TertiaryColor.displayName = 'Button.TertiaryColor'

Button.TertiaryGray = generateButtonVariant('TertiaryGray')
Button.TertiaryGray.displayName = 'Button.TertiaryGray'

Button.TertiaryDestructive = generateButtonVariant('TertiaryDestructive')
Button.TertiaryDestructive.displayName = 'Button.TertiaryDestructive'

Button.LinkColor = generateButtonVariant('LinkColor')
Button.LinkColor.displayName = 'Button.LinkColor'

Button.LinkGray = generateButtonVariant('LinkGray')
Button.LinkGray.displayName = 'Button.LinkGray'

Button.LinkDestructive = generateButtonVariant('LinkDestructive')
Button.LinkDestructive.displayName = 'Button.LinkDestructive'

export { Button }
2 changes: 2 additions & 0 deletions src/design-system/components/CheckboxButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,5 @@ export const CheckboxButton = ({
</Box>
)
}

CheckboxButton.displayName = 'CheckboxButton'
6 changes: 4 additions & 2 deletions src/design-system/components/CircleLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useTheme } from '@baca/hooks'
import { useCircleLoader } from '@baca/hooks/loaders'
import React from 'react'
import Animated, {
Expand Down Expand Up @@ -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,
Expand All @@ -114,7 +116,7 @@ export const CircleLoader = ({
} as const

const circleStyleProps = {
color,
color: color || theme.colors.text.primary,
size,
thickness,
}
Expand Down
2 changes: 2 additions & 0 deletions src/design-system/components/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ export const Loader = ({ type, ...props }: LoaderType): JSX.Element => {

return renderLoader
}

Loader.displayName = 'Loader'
Loading