Skip to content

Commit

Permalink
misc: Skeleton circular should use size attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmonjol committed Nov 15, 2024
1 parent 592ffcf commit 90bb269
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/components/designSystem/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Typography } from './Typography'

import { colors } from '../../../tailwind.config'

export type AvatarSize = 'small' | 'intermediate' | 'medium' | 'big' | 'large'
export type AvatarSize = 'tiny' | 'small' | 'intermediate' | 'medium' | 'big' | 'large'
type AvatarVariant = 'connector' | 'user' | 'company' | 'connector-full'

interface AvatarConnectorProps {
Expand All @@ -30,6 +30,7 @@ export interface AvatarGenericProps {

const mapTypographyVariant = (size: AvatarSize) => {
switch (size) {
case 'tiny':
case 'small':
case 'intermediate':
return 'noteHl'
Expand Down Expand Up @@ -78,6 +79,7 @@ const getBackgroundColorKey = (identifier?: string): keyof typeof colors.avatar
}

export const avatarSizeStyles: Record<AvatarSize, string> = {
tiny: cx('w-2 min-w-2 h-2 rounded'),
small: cx('w-4 min-w-4 h-4 rounded'),
intermediate: cx('w-6 min-w-6 h-6 rounded-lg'),
medium: cx('w-8 min-w-8 h-8 rounded-xl'),
Expand Down
8 changes: 2 additions & 6 deletions src/components/designSystem/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type SkeletonVariant =
type SkeletonColor = 'dark' | 'light'

interface SkeletonConnectorProps {
variant: Extract<SkeletonVariant, 'userAvatar' | 'connectorAvatar'>
variant: Extract<SkeletonVariant, 'userAvatar' | 'connectorAvatar' | 'circular'>
size: AvatarSize
/**
* @deprecated Use `className` and TailwindCSS instead
Expand All @@ -41,15 +41,11 @@ interface SkeletonConnectorProps {
}

interface SkeletonGenericProps {
variant: Extract<SkeletonVariant, 'text' | 'circular'>
variant: Extract<SkeletonVariant, 'text'>
/**
* @deprecated Use `className` and TailwindCSS instead
*/
width?: number | string
/**
* @deprecated Use `className` and TailwindCSS instead
*/
height?: number | string
size?: never
className?: string
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const ComboBox = ({
<LoadingIemsWrapper>
{[1, 2, 3].map((i) => (
<LoadingItem key={`combobox-loading-item-${i}`}>
<Skeleton variant="circular" width={16} height={16} marginRight="16px" />
<Skeleton variant="circular" size="small" marginRight="16px" />
<Skeleton variant="text" width="100%" />
</LoadingItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/graphs/Invoices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ const Invoices = ({
<div>
{[...Array(3)].map((_, index) => (
<SkeletonLine key={`invoices-skeleton-${index}`}>
<Skeleton variant="circular" width={8} height={8} />
<Skeleton variant="circular" size="tiny" />
<Skeleton variant="text" width="32%" />
<Skeleton variant="text" width="32%" />
</SkeletonLine>
Expand Down
2 changes: 1 addition & 1 deletion src/components/graphs/Usage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const Usage = ({
<div>
{[...Array(3)].map((_, index) => (
<SkeletonLine key={`usage-skeleton-${index}`}>
<Skeleton variant="circular" width={8} height={8} />
<Skeleton variant="circular" size="tiny" />
<Skeleton variant="text" width="32%" />
<Skeleton variant="text" width="32%" />
</SkeletonLine>
Expand Down
2 changes: 1 addition & 1 deletion src/components/plans/details/PlanSubscriptionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const PlanSubscriptionListItemSkeleton = ({
return (
<SkeletonWrapper className={className}>
<CustomerNameWrapper>
<Skeleton variant="circular" width={40} height={40} />
<Skeleton variant="circular" size="big" />
<CustomerBlockInfos>
<Skeleton variant="text" width={160} marginBottom={14} />
<Skeleton variant="text" width={100} />
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/SideNavLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ const SideNav = () => {
<VerticalMenu
loading={currentUserLoading}
loadingComponent={
<div className="flex flex-1 flex-col gap-4">
<div className="flex flex-1 gap-4">
{[1, 2, 3, 4, 5, 6, 7].map((i) => (
<div
key={`skeleton-upper-nav-${i}`}
className="flex flex-1 flex-row items-center gap-3 pt-3"
>
<Skeleton variant="circular" width={16} height={16} />
<Skeleton variant="circular" size="small" />
<Skeleton variant="text" width={120} />
</div>
))}
Expand Down Expand Up @@ -312,8 +312,8 @@ const SideNav = () => {
direction={'row'}
paddingTop={3}
>
<Skeleton variant="circular" width={16} height={16} />
<Skeleton variant="text" width={120} />
<Skeleton variant="circular" size="small" />
<Skeleton variant="text" height={16} width={120} />

Check failure on line 316 in src/layouts/SideNavLayout.tsx

View workflow job for this annotation

GitHub Actions / Run Codegen

Type '{ variant: "text"; height: number; width: number; }' is not assignable to type 'IntrinsicAttributes & (SkeletonConnectorProps | SkeletonGenericProps)'.

Check failure on line 316 in src/layouts/SideNavLayout.tsx

View workflow job for this annotation

GitHub Actions / Run Codegen

Type '{ variant: "text"; height: number; width: number; }' is not assignable to type 'IntrinsicAttributes & (SkeletonConnectorProps | SkeletonGenericProps)'.
</Stack>
))}
</Stack>
Expand Down

0 comments on commit 90bb269

Please sign in to comment.