Implemented ConflictsWithWarning
This commit is contained in:
25
src/stories/components/ConflictsWithWarning.stories.tsx
Normal file
25
src/stories/components/ConflictsWithWarning.stories.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import ConflictsWithWarning from '@views/components/common/ConflictsWithWarning/ConflictsWithWarning';
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
title: 'Components/Common/ConflictsWithWarning',
|
||||||
|
component: ConflictsWithWarning,
|
||||||
|
parameters: {
|
||||||
|
layout: 'centered',
|
||||||
|
},
|
||||||
|
tags: ['autodocs'],
|
||||||
|
argTypes: {
|
||||||
|
ConflictingCourse: { control: 'string' },
|
||||||
|
SectionNumber: { control: 'string' },
|
||||||
|
},
|
||||||
|
} satisfies Meta<typeof ConflictsWithWarning>;
|
||||||
|
export default meta;
|
||||||
|
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
|
export const Default: Story = {
|
||||||
|
args: {
|
||||||
|
ConflictingCourse: 'BVO 311C',
|
||||||
|
SectionNumber: '47280',
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Text from '../Text/Text';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Props for PopupCourseBlock
|
||||||
|
*/
|
||||||
|
export interface ConflictsWithWarningProps {
|
||||||
|
ConflictingCourse: string;
|
||||||
|
SectionNumber: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "course block" to be used in the extension popup.
|
||||||
|
*
|
||||||
|
* @param props ConflictsWithWarningProps
|
||||||
|
*/
|
||||||
|
export default function ConflictsWithWarning( { ConflictingCourse, SectionNumber }: ConflictsWithWarningProps): JSX.Element {
|
||||||
|
const UniqueCourseConflictText = `${ConflictingCourse} (${SectionNumber})`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex w-21 min-w-21 p-2.5 flex-col items-start gap-2.5 rounded bg-[#AF2E2D]">
|
||||||
|
<ConflictsWithoutWarningText>
|
||||||
|
Conflicts With:
|
||||||
|
</ConflictsWithoutWarningText>
|
||||||
|
<ConflictsWithoutWarningText>
|
||||||
|
{UniqueCourseConflictText}
|
||||||
|
</ConflictsWithoutWarningText>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ConflictsWithoutWarningText( {children}: {children: string} ) {
|
||||||
|
return (
|
||||||
|
<Text
|
||||||
|
variant='mini'
|
||||||
|
as='span'
|
||||||
|
className='text-white'
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user