-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
378 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Ionicons as ExpoIonicons } from '@expo/vector-icons'; | ||
import { cssInterop } from 'nativewind'; | ||
import ContentLoader, { Rect } from 'react-content-loader/native'; | ||
import { Dimensions, View } from 'react-native'; | ||
import type { Tag } from '@/types/entities'; | ||
import { Text } from '@/shared/components/ui/text'; | ||
|
||
const { width: wWidth } = Dimensions.get('window'); | ||
|
||
const Ionicons = cssInterop(ExpoIonicons, { | ||
className: { | ||
target: 'style', | ||
nativeStyleToProp: { | ||
color: 'color', | ||
}, | ||
}, | ||
}); | ||
|
||
interface TagCardProps { | ||
data: Tag; | ||
} | ||
|
||
export const TagCard: React.FC<TagCardProps> = (props) => { | ||
const { data } = props; | ||
|
||
return ( | ||
<View key={data.uuid} className="flex-row items-center justify-between px-4 py-4"> | ||
<View className="flex-row items-center gap-3"> | ||
<Ionicons name="pricetag-outline" size={19} className="text-primary" /> | ||
|
||
<Text variant="paragraphMedium">{data.title}</Text> | ||
</View> | ||
|
||
<Text variant="paragraphCaption" className="text-zinc-500"> | ||
23 quotes | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export interface TagCardSkeletonProps {} | ||
|
||
export const TagCardSkeleton: React.FC<TagCardSkeletonProps> = () => { | ||
return ( | ||
<ContentLoader | ||
speed={2} | ||
width={wWidth} | ||
height={166} | ||
viewBox={`0 0 ${wWidth} 166`} | ||
backgroundColor="#e5e7eb" | ||
foregroundColor="#d1d5db" | ||
> | ||
<Rect x="16" y="16" rx="4" ry="4" width={wWidth - 64} height="16" /> | ||
<Rect x="16" y="40" rx="4" ry="4" width={wWidth - 96} height="16" /> | ||
<Rect x="16" y="64" rx="4" ry="4" width={wWidth - 128} height="16" /> | ||
</ContentLoader> | ||
); | ||
}; |
21 changes: 21 additions & 0 deletions
21
packages/app/src/features/tag/contracts/tag-service.contract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { ApiPaginatedResult, Paginate } from '@/types/api'; | ||
import type { Tag } from '@/types/entities'; | ||
|
||
export type CreateTagPayload = { | ||
title: string; | ||
}; | ||
|
||
export type CreateTagOutput = Tag; | ||
|
||
export type ListTagsPayload = { | ||
paginate?: Paginate; | ||
page?: number; | ||
}; | ||
|
||
export type ListTagsOutput = ApiPaginatedResult<Tag>; | ||
|
||
export abstract class TagServiceContract { | ||
public abstract list(payload: ListTagsPayload): Promise<ListTagsOutput>; | ||
|
||
public abstract create(payload: CreateTagPayload): Promise<CreateTagOutput>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { TagServiceContract } from '@/features/tag/contracts/tag-service.contract'; | ||
import { TagService } from '@/features/tag/services/tag.service'; | ||
import { httpClientService } from '@/shared/services'; | ||
|
||
const tagService: TagServiceContract = new TagService(httpClientService); | ||
|
||
export { tagService }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { | ||
CreateTagOutput, | ||
CreateTagPayload, | ||
ListTagsOutput, | ||
ListTagsPayload, | ||
TagServiceContract, | ||
} from '@/features/tag/contracts/tag-service.contract'; | ||
import type { HttpClientServiceContract } from '@/shared/contracts/http-client-service.contract'; | ||
|
||
export class TagService implements TagServiceContract { | ||
constructor(private readonly httpClientService: HttpClientServiceContract) {} | ||
|
||
public list(payload: ListTagsPayload): Promise<ListTagsOutput> { | ||
return this.httpClientService.get<ListTagsOutput, ListTagsPayload>('/tags', { | ||
...payload, | ||
}); | ||
} | ||
|
||
public async create(payload: CreateTagPayload): Promise<CreateTagOutput> { | ||
return this.httpClientService.post<CreateTagOutput, CreateTagPayload>('/tags', payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as z from 'zod'; | ||
|
||
export const createTagFormSchema = z.object({ | ||
title: z.string(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.