Skip to content
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
1 change: 0 additions & 1 deletion src/components/molecules/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './BootomSheetScrollables'
export * from './Field'
export * from './MenuItem'
export * from './TextArea'
2 changes: 1 addition & 1 deletion src/design-system/bottomSheets/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
import { RefObject, useCallback } from 'react'
import { Dimensions } from 'react-native'

import { BottomSheetScrollView } from './BootomSheetScrollables'
import { BottomSheetHeader } from './BottomSheetHeader'
import { BottomSheetScrollView } from '../../components/molecules'

const screenHeight = Dimensions.get('screen').height

Expand Down
2 changes: 1 addition & 1 deletion src/design-system/bottomSheets/BottomSheetFlatList.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// export { BottomSheetFlatList } from '@gorhom/bottom-sheet'
export { BottomSheetFlatList } from '../../components/molecules'
export { BottomSheetFlatList } from './BootomSheetScrollables'
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ exports[`Button renders correctly 1`] = `
style={
{
"color": "#FFFFFF",
"fontFamily": "Inter_Semibold",
"fontFamily": "Inter_SemiBold",
"fontSize": 14,
"fontStyle": "normal",
"fontWeight": "400",
Expand Down
40 changes: 28 additions & 12 deletions src/design-system/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
displayVariants,
fontDisplaySize,
fontTextSize,
FontWeight,
fontWeights,
TextVariant,
textVariants,
Expand Down Expand Up @@ -73,25 +74,40 @@ const RawText = memo(
) => {
const theme = useTheme()

const { fontWeight: variantFontWeight, fontSize: variantFontSize } =
type === 'text' ? textVariants[variant as TextVariant] : displayVariants[variant]
const { fontWeight: variantFontWeight, fontSize: variantFontSize } = useMemo(
() => (type === 'text' ? textVariants[variant as TextVariant] : displayVariants[variant]),
[type, variant]
)

const fontFamily = props.fontFamily || variantFontWeight
const fontWeight = bold ? 'bold' : props.fontWeight || fontWeights[variantFontWeight]
const fontSize =
props.fontSize ||
(type === 'text'
? fontTextSize[variantFontSize as keyof typeof fontTextSize]
: fontDisplaySize[variantFontSize])
const fontFamily = useMemo(
(): FontWeight => props.fontFamily || variantFontWeight,
[props.fontFamily, variantFontWeight]
)
const fontWeight = useMemo(
(): TextStyle['fontWeight'] =>
bold ? 'bold' : props.fontWeight || fontWeights[variantFontWeight],
[bold, props.fontWeight, variantFontWeight]
)
const fontSize = useMemo(
(): number =>
props.fontSize ||
(type === 'text'
? fontTextSize[variantFontSize as keyof typeof fontTextSize]
: fontDisplaySize[variantFontSize]),
[props.fontSize, type, variantFontSize]
)

const fontFamilyStyle = useMemo<TextStyle>(
() => ({
fontFamily: fontFamily ? theme.fonts[fontFamily] : undefined,
fontFamily: fontFamily ? theme.fonts[variantFontWeight] : undefined,
}),
[theme, fontFamily]
[fontFamily, theme.fonts, variantFontWeight]
)

const finalFontSize = fontSize && typeof fontSize === 'number' ? fontSize : undefined
const finalFontSize = useMemo(
() => (fontSize && typeof fontSize === 'number' ? fontSize : undefined),
[fontSize]
)

const lineHeightStyle = useMemo<TextStyle>(
() => ({
Expand Down
2 changes: 1 addition & 1 deletion src/design-system/config/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const fontWeights: { [key in FontWeight]: '400' | '500' | '600' | '700' }
export const fonts: { [key in FontWeight]: string } = {
Regular: 'Inter_Regular',
Medium: 'Inter_Medium',
Semibold: 'Inter_Semibold',
Semibold: 'Inter_SemiBold',
Bold: 'Inter_Bold',
} as const

Expand Down