-
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.
Merge pull request #6 from SantiagoJavierRubio/client-styles
Add styling to client
- Loading branch information
Showing
10 changed files
with
347 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PropsWithChildren } from 'react' | ||
|
||
export default function Container({ ...props }: PropsWithChildren) { | ||
return ( | ||
<section className="max-h-screen h-screen max-w-6xl w-full overflow-y-auto p-4 no-scrollbar">{props.children}</section> | ||
) | ||
} |
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 { Loader2 } from 'lucide-react' | ||
|
||
export default function Loader() { | ||
return ( | ||
<div className='w-full h-full flex items-center justify-center'><Loader2 className='animate-spin' size={32}/></div> | ||
) | ||
} |
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,55 @@ | ||
import { Eye } from 'lucide-react' | ||
import type { PropsWithChildren, HTMLAttributes } from 'react' | ||
import { Tooltip } from 'react-tooltip' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
export function Cell({ children, className, ...props }: PropsWithChildren<HTMLAttributes<HTMLDivElement>>) { | ||
return ( | ||
<div className={twMerge('py-5 px-2', className)} {...props}>{children}</div> | ||
) | ||
} | ||
|
||
type AvatarCellProps = { | ||
url: string | ||
alt: string | ||
profile_url: string | ||
} & PropsWithChildren<HTMLAttributes<HTMLDivElement>> | ||
export function AvatarCell({ url, alt, profile_url, ...props }: AvatarCellProps) { | ||
return ( | ||
<> | ||
<Cell className='p-0 aspect-square h-8 cursor-pointer group' {...props}> | ||
<a href={profile_url} target='_blank' referrerPolicy='no-referrer' rel="noreferrer"> | ||
<img | ||
data-tooltip-id='profile_link' | ||
data-tooltip-content='Go to profile' | ||
src={url} | ||
alt={alt} | ||
className=' object-fill rounded-full group-hover:scale-110 transition-all' | ||
/> | ||
</a> | ||
</Cell> | ||
<Tooltip id='profile_link' /> | ||
</> | ||
) | ||
} | ||
|
||
type LinkCellProps = { | ||
url: string | ||
} & PropsWithChildren<HTMLAttributes<HTMLDivElement>> | ||
export function LinkCell({ url, ...props }: LinkCellProps) { | ||
return ( | ||
<> | ||
<Cell className='cursor-pointer group' {...props}> | ||
<a href={url} target='_blank' referrerPolicy='no-referrer' rel="noreferrer"> | ||
<Eye | ||
data-tooltip-id='gh_link' | ||
data-tooltip-content='Inspect on Github' | ||
className='group-hover:stroke-[2.5] group-hover:scale-105 transition-all | ||
stroke-textDark group-hover:stroke-textLight outline-none' | ||
/> | ||
</a> | ||
</Cell> | ||
<Tooltip id='gh_link' className='text-red-500' /> | ||
</> | ||
) | ||
} |
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,43 @@ | ||
import type { PropsWithChildren, HTMLAttributes } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
import { ArrowDown, ArrowDownAZ, ArrowDownZA, ArrowUp, Calendar } from 'lucide-react' | ||
import { SortDirection } from '@tanstack/react-table' | ||
|
||
export function Header({ className, children, ...props }: PropsWithChildren<HTMLAttributes<HTMLDivElement>>) { | ||
return ( | ||
<div className={twMerge('p-4 bg-bgLight h-10 flex items-center justify-center', className)} {...props}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
type SortableHeaderProps = { | ||
sortingType: 'alphabetical' | 'date' | ||
sortDirection: false | SortDirection | ||
} & PropsWithChildren<HTMLAttributes<HTMLDivElement>> | ||
export function SortableHeader({ sortingType, sortDirection, children, ...props }: SortableHeaderProps) { | ||
return ( | ||
<Header {...props}> | ||
{children} | ||
<div className='ml-2 bg-transparent'> | ||
{(sortingType === 'alphabetical') && (sortDirection === 'desc' | ||
? <ArrowDownZA size={20} /> | ||
: sortDirection && <ArrowDownAZ size={20} />)} | ||
{sortingType === 'date' && <DateSortIcon direction={sortDirection} /> } | ||
</div> | ||
</Header> | ||
) | ||
} | ||
export function DateSortIcon({ direction }: { direction: SortableHeaderProps['sortDirection']}) { | ||
if (!direction) return null | ||
return ( | ||
<div className='relative'> | ||
<Calendar size={20}/> | ||
<div className='absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/4 '> | ||
{direction === 'asc' | ||
? <ArrowUp size={12} strokeWidth={3}/> | ||
: <ArrowDown size={12} strokeWidth={3} />} | ||
</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.