This repository was archived by the owner on May 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +117
-0
lines changed Expand file tree Collapse file tree 10 files changed +117
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Flex , Text } from '@chakra-ui/react' ;
2+ import { Avatar } from '@codiga/components' ;
3+ import { PublicUser } from '../../types/userTypes' ;
4+ import { getAvatarUrl } from '../../utils/userUtils' ;
5+ import UserLink from '../UserLink' ;
6+
7+ type AvatarAndNameProps = {
8+ owner ?: PublicUser ;
9+ } ;
10+
11+ export default function AvatarAndName ( { owner = { } } : AvatarAndNameProps ) {
12+ return (
13+ < Flex alignItems = "center" gap = "space_8" >
14+ < Avatar
15+ size = "xs"
16+ name = { owner ?. displayName || 'Anonymous' }
17+ src = { getAvatarUrl ( { id : owner ?. id } ) }
18+ />
19+ < Text
20+ size = "xs"
21+ noOfLines = { 1 }
22+ maxW = "300px"
23+ display = "inline-block"
24+ whiteSpace = "nowrap"
25+ >
26+ < UserLink owner = { owner } />
27+ </ Text >
28+ </ Flex >
29+ ) ;
30+ }
Original file line number Diff line number Diff line change 1+ export { default } from './AvatarAndName' ;
Original file line number Diff line number Diff line change 1+ import { IconButton } from '@chakra-ui/react' ;
2+ import { ChevronLeftIcon } from '@codiga/components' ;
3+ import { useNavigate } from 'react-router-dom' ;
4+
5+ export default function BackButton ( ) {
6+ const navigate = useNavigate ( ) ;
7+
8+ return (
9+ < IconButton
10+ variant = "ghost"
11+ onClick = { ( ) => navigate ( - 1 ) }
12+ h = "28px"
13+ minW = "28px"
14+ fontSize = "12px"
15+ icon = { < ChevronLeftIcon /> }
16+ aria-label = "go back"
17+ />
18+ ) ;
19+ }
Original file line number Diff line number Diff line change 1+ export { default } from './BackButton' ;
Original file line number Diff line number Diff line change 1+ import { Flex , Text } from '@chakra-ui/react' ;
2+
3+ type FormattedDateProps = {
4+ timestamp : number ;
5+ } ;
6+
7+ export default function FormattedDate ( { timestamp } : FormattedDateProps ) {
8+ return (
9+ < Flex alignItems = "center" gap = "space_8" >
10+ < Text size = "xs" noOfLines = { 1 } >
11+ { new Date ( timestamp ) . toDateString ( ) }
12+ </ Text >
13+ </ Flex >
14+ ) ;
15+ }
Original file line number Diff line number Diff line change 1+ export { default } from './FormattedDate' ;
Original file line number Diff line number Diff line change 1+ import { Flex , Text } from '@chakra-ui/react' ;
2+ import { LockIcon } from '@codiga/components' ;
3+ import VotesCurrent from '../VotesCurrent' ;
4+
5+ type PrivacyAndNotesProps = {
6+ isPublic ?: boolean ;
7+ upvotes ?: number ;
8+ downvotes ?: number ;
9+ } ;
10+
11+ export default function PrivacyAndVotes ( {
12+ isPublic = true ,
13+ upvotes = 0 ,
14+ downvotes = 0 ,
15+ } : PrivacyAndNotesProps ) {
16+ return (
17+ < Flex alignItems = "center" gap = "space_8" >
18+ < Text
19+ size = "xs"
20+ noOfLines = { 1 }
21+ gridGap = "space_4"
22+ d = "flex"
23+ alignItems = "center"
24+ >
25+ < LockIcon open = { ! ! isPublic } />
26+ { isPublic ? 'Public' : 'Private' }
27+ </ Text >
28+ < VotesCurrent upvotes = { upvotes } downvotes = { downvotes } />
29+ </ Flex >
30+ ) ;
31+ }
Original file line number Diff line number Diff line change 1+ export { default } from './PrivacyAndVotes' ;
Original file line number Diff line number Diff line change 1+ import { Flex , Text } from '@chakra-ui/react' ;
2+ import { CodeIcon } from '@codiga/components' ;
3+
4+ type UsesProps = {
5+ count ?: number ;
6+ } ;
7+
8+ export default function Uses ( { count = 0 } : UsesProps ) {
9+ return (
10+ < Flex alignItems = "center" gap = "space_8" >
11+ < CodeIcon />
12+ < Text size = "xs" noOfLines = { 1 } >
13+ { count }
14+ </ Text >
15+ </ Flex >
16+ ) ;
17+ }
Original file line number Diff line number Diff line change 1+ export { default } from './Uses' ;
You can’t perform that action at this time.
0 commit comments