Skip to content

Commit

Permalink
fix: title max length
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Dec 28, 2024
1 parent 451dbea commit bfc7c5a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/(home)/post/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import ErrorBoundary from 'react-native-error-boundary';
import FallbackComponent from '../../../../src/components/uis/FallbackComponent';
import useSupabase from '../../../../src/hooks/useSupabase';
import {Hr, Icon, Typography, useCPK} from 'cpk-ui';
import {TITLE_MAX_LENGTH} from '../../../../src/utils/constants';

const Container = styled.View`
background-color: ${({theme}) => theme.bg.basic};
Expand Down Expand Up @@ -355,7 +356,10 @@ export default function PostDetails(): JSX.Element {
<ErrorBoundary FallbackComponent={FallbackComponent}>
<Stack.Screen
options={{
title: (post?.title || t('common.post')).substring(0, 29),
title:
(post?.title || t('common.post')).length > TITLE_MAX_LENGTH
? `${(post?.title || t('common.post')).substring(0, TITLE_MAX_LENGTH)}...`
: post?.title || t('common.post'),
headerRight: () =>
authId ? (
<View
Expand Down
10 changes: 8 additions & 2 deletions app/(home)/post/[id]/update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import NotFound from '../../../../src/components/uis/NotFound';
import {useState} from 'react';
import {ImagePickerAsset} from 'expo-image-picker';
import MultiUploadImageInput from '../../../../src/components/uis/MultiUploadImageInput';
import {MAX_IMAGES_UPLOAD_LENGTH} from '../../../../src/utils/constants';
import {
MAX_IMAGES_UPLOAD_LENGTH,
TITLE_MAX_LENGTH,
} from '../../../../src/utils/constants';
import CustomScrollView from '../../../../src/components/uis/CustomScrollView';
import {filterUploadableAssets} from '../../../../src/utils/common';
import {RectButton} from 'react-native-gesture-handler';
Expand Down Expand Up @@ -302,7 +305,10 @@ export default function PostUpdate(): JSX.Element {
<ErrorBoundary FallbackComponent={FallbackComponent}>
<Stack.Screen
options={{
title: post?.title || t('common.post'),
title:
(post?.title || t('common.post')).length > TITLE_MAX_LENGTH
? `${(post?.title || t('common.post')).substring(0, TITLE_MAX_LENGTH)}...`
: post?.title || t('common.post'),
headerRight: () =>
Platform.OS === 'web' ? (
<Pressable
Expand Down
2 changes: 2 additions & 0 deletions src/components/uis/PostListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default function PostListItem({
>
<Typography.Body2
style={css`
flex: 1;
padding-right: 8px;
font-family: Pretendard-Bold;
`}
>
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Platform } from 'react-native';
import {DoobooGithubStats, Stats} from '../types/github-stats';

export const LIST_CNT = 10;
Expand All @@ -15,6 +16,7 @@ export const HEADER_HEIGHT = 56;
export const MAX_IMAGES_UPLOAD_LENGTH = 5;
export const MAX_WIDTH = 1000;
export const EMAIL_ADDRESS = '[email protected]';
export const TITLE_MAX_LENGTH = Platform.OS === 'web' ? 52 : 29;

export const initStats: Stats = {
name: '',
Expand Down

0 comments on commit bfc7c5a

Please sign in to comment.