forked from Longhorn-Developers/UT-Registration-Plus
-
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 branch 'main' into ListComponentContinuation
- Loading branch information
Showing
5 changed files
with
128 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Chromatic" | ||
|
||
on: [push, pull_request_target] | ||
|
||
jobs: | ||
chromatic: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Publish to Chromatic | ||
uses: chromaui/action@latest | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
exitZeroOnChanges: true | ||
autoAcceptChanges: "main" |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
import React from 'react'; | ||
|
||
import { Status } from '@shared/types/Course'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import CourseStatus from '@views/components/common/CourseStatus/CourseStatus'; | ||
|
||
const meta = { | ||
title: 'Components/Common/CourseStatus', | ||
component: CourseStatus, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
args: { | ||
status: Status.WAITLISTED, | ||
size: 'small', | ||
}, | ||
argTypes: { | ||
status: { | ||
options: Object.values(Status), | ||
mapping: Object.values(Status), | ||
control: { | ||
type: 'select', | ||
labels: Object.keys(Status), | ||
}, | ||
}, | ||
size: { | ||
options: ['small', 'mini'], | ||
control: { | ||
type: 'radio', | ||
}, | ||
}, | ||
}, | ||
} satisfies Meta<typeof CourseStatus>; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const Variants: Story = { | ||
render: args => ( | ||
<div className='flex flex-col gap-4 items-center'> | ||
<CourseStatus {...args} size='small' /> | ||
<CourseStatus {...args} size='mini' /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Status } from '@shared/types/Course'; | ||
import { StatusIcon } from '@shared/util/icons'; | ||
import clsx from 'clsx'; | ||
import React from 'react'; | ||
import Text from '../Text/Text'; | ||
|
||
type SizeType = 'small' | 'mini'; | ||
|
||
/** | ||
* Props for CourseStatus | ||
*/ | ||
export interface CourseStatusProps { | ||
status: Status; | ||
size: SizeType; | ||
} | ||
|
||
/** | ||
* The CourseStatus component as per the Labels and Details Figma section | ||
* | ||
* @param props CourseStatusProps | ||
*/ | ||
export default function CourseStatus({ status, size }: CourseStatusProps): JSX.Element { | ||
const statusIconSizeClass = clsx({ | ||
'h-5 w-5': size === 'small', | ||
'h-4 w-4': size === 'mini', | ||
}); | ||
|
||
return ( | ||
<div className={`inline-flex items-center ${size === 'small' ? 'gap-2' : 'gap-1.5'}`}> | ||
<div className='ml-1 flex items-center justify-center rounded bg-slate-700 p-1px text-white'> | ||
<StatusIcon status={status} className={statusIconSizeClass} /> | ||
</div> | ||
<Text variant={size}>{status}</Text> | ||
</div> | ||
); | ||
} |