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

Fix drawer icon sizing issue #7417

Merged
merged 1 commit into from
Feb 2, 2024
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
4 changes: 2 additions & 2 deletions packages/mobile/src/components/drawer/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ComponentType, ReactNode } from 'react'
import { useMemo, useCallback, useEffect, useRef, useState } from 'react'

import type { IconComponent } from '@audius/harmony'
import type {
GestureResponderEvent,
ImageSourcePropType,
Expand All @@ -19,7 +20,6 @@ import type { Edge } from 'react-native-safe-area-context'
import { useSafeAreaInsets, SafeAreaView } from 'react-native-safe-area-context'

import { makeStyles } from 'app/styles'
import type { SvgProps } from 'app/types/svg'
import { attachToDy } from 'app/utils/animation'

import { DrawerHeader } from './DrawerHeader'
Expand Down Expand Up @@ -120,7 +120,7 @@ export type DrawerProps = {
/**
* Icon to display in the header next to the title (must also include title)
*/
titleIcon?: ComponentType<SvgProps>
titleIcon?: IconComponent
/**
* Icon (as image source) to display in the header next to the title (must also include title)
*/
Expand Down
22 changes: 8 additions & 14 deletions packages/mobile/src/components/drawer/DrawerHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { ComponentType, ReactNode } from 'react'
import type { ReactNode } from 'react'

import type { IconComponent } from '@audius/harmony'
import type { ImageSourcePropType } from 'react-native'
import { TouchableOpacity, View, Image } from 'react-native'

import { IconClose } from '@audius/harmony-native'
import { Flex, IconClose } from '@audius/harmony-native'
import { Text } from 'app/components/core'
import { makeStyles } from 'app/styles'
import type { SvgProps } from 'app/types/svg'
import { useColor } from 'app/utils/theme'

type DrawerHeaderProps = {
onClose: () => void
title?: ReactNode
titleIcon?: ComponentType<SvgProps>
titleIcon?: IconComponent
titleImage?: ImageSourcePropType
isFullscreen?: boolean
}
Expand All @@ -31,10 +31,6 @@ export const useStyles = makeStyles(({ spacing }) => ({
left: spacing(6)
},

titleContainer: {
flexDirection: 'row',
columnGap: spacing(2)
},
titleImage: {
height: spacing(6),
width: spacing(6)
Expand All @@ -61,21 +57,19 @@ export const DrawerHeader = (props: DrawerHeaderProps) => {
onPress={onClose}
style={styles.dismissContainer}
>
<IconClose width={30} height={30} fill={iconRemoveColor} />
<IconClose size='m' fill={iconRemoveColor} />
</TouchableOpacity>
) : null}
{title ? (
<View style={styles.titleContainer}>
{TitleIcon ? (
<TitleIcon height={22} width={22} fill={titleIconColor} />
) : null}
<Flex gap='s' alignItems='center' direction='row'>
{TitleIcon ? <TitleIcon size='m' fill={titleIconColor} /> : null}
{titleImage ? (
<Image style={styles.titleImage} source={titleImage} />
) : null}
<Text fontSize='xl' weight='heavy' textTransform='uppercase'>
{title}
</Text>
</View>
</Flex>
) : null}
</View>
) : (
Expand Down