fixes + added button titles

This commit is contained in:
Sriram Hariharan
2023-09-17 19:38:12 -05:00
parent aea9b16f98
commit 4f170db07d
6 changed files with 31 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ interface Props {
onClick?: () => void; onClick?: () => void;
type?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'success' | 'info'; type?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'success' | 'info';
disabled?: boolean; disabled?: boolean;
title?: string;
testId?: string; testId?: string;
} }
@@ -22,6 +23,7 @@ export function Button({
testId, testId,
children, children,
disabled, disabled,
title,
onClick, onClick,
}: React.PropsWithChildren<Props>): JSX.Element { }: React.PropsWithChildren<Props>): JSX.Element {
return ( return (
@@ -31,6 +33,7 @@ export function Button({
className={classNames(styles.button, className, styles[type ?? 'primary'], { className={classNames(styles.button, className, styles[type ?? 'primary'], {
[styles.disabled]: disabled, [styles.disabled]: disabled,
})} })}
title={title}
onClick={disabled ? undefined : onClick} onClick={disabled ? undefined : onClick}
> >
{children} {children}

View File

@@ -7,6 +7,7 @@ import styles from './Link.module.scss';
type Props = Omit<TextProps, 'span'> & { type Props = Omit<TextProps, 'span'> & {
url?: string; url?: string;
disabled?: boolean; disabled?: boolean;
title?: string;
}; };
/** /**

View File

@@ -11,6 +11,7 @@ export type TextProps = {
span?: boolean; span?: boolean;
className?: string; className?: string;
onClick?: () => void; onClick?: () => void;
title?: string;
align?: React.CSSProperties['textAlign']; align?: React.CSSProperties['textAlign'];
style?: React.CSSProperties; style?: React.CSSProperties;
}; };
@@ -32,14 +33,14 @@ export default function Text(props: PropsWithChildren<TextProps>) {
if (props.span) { if (props.span) {
return ( return (
<span className={className} style={style} onClick={props.onClick}> <span title={props.title} className={className} style={style} onClick={props.onClick}>
{props.children} {props.children}
</span> </span>
); );
} }
return ( return (
<div className={className} style={style} onClick={props.onClick}> <div title={props.title} className={className} style={style} onClick={props.onClick}>
{props.children} {props.children}
</div> </div>
); );

View File

@@ -85,19 +85,30 @@ export default function CourseButtons({ course, activeSchedule }: Props) {
disabled={!course.instructors.length} disabled={!course.instructors.length}
type='primary' type='primary'
className={styles.button} className={styles.button}
title='Search for this professor on RateMyProfessor'
> >
<Text size='medium' weight='regular' color='white'> <Text size='medium' weight='regular' color='white'>
RateMyProf RateMyProf
</Text> </Text>
<Icon className={styles.icon} color='white' name='school' size='medium' /> <Icon className={styles.icon} color='white' name='school' size='medium' />
</Button> </Button>
<Button onClick={openSyllabiURL} type='secondary' className={styles.button}> <Button
onClick={openSyllabiURL}
type='secondary'
className={styles.button}
title='Search for syllabi for this course'
>
<Text size='medium' weight='regular' color='white'> <Text size='medium' weight='regular' color='white'>
Syllabi Syllabi
</Text> </Text>
<Icon className={styles.icon} color='white' name='grading' size='medium' /> <Icon className={styles.icon} color='white' name='grading' size='medium' />
</Button> </Button>
<Button onClick={openTextbookURL} type='tertiary' className={styles.button}> <Button
onClick={openTextbookURL}
type='tertiary'
className={styles.button}
title='Search for textbooks for this course'
>
<Text size='medium' weight='regular' color='white'> <Text size='medium' weight='regular' color='white'>
Textbook Textbook
</Text> </Text>
@@ -106,6 +117,7 @@ export default function CourseButtons({ course, activeSchedule }: Props) {
<Button <Button
disabled={!activeSchedule} disabled={!activeSchedule}
onClick={isCourseSaved ? handleRemoveCourse : handleSaveCourse} onClick={isCourseSaved ? handleRemoveCourse : handleSaveCourse}
title={isCourseSaved ? 'Remove this course from your schedule' : 'Add this course to your schedule'}
type={isCourseSaved ? 'danger' : 'success'} type={isCourseSaved ? 'danger' : 'success'}
className={styles.button} className={styles.button}
> >

View File

@@ -37,6 +37,7 @@ export default function CourseHeader({ course, activeSchedule, onClose }: Props)
size='medium' size='medium'
weight='semi_bold' weight='semi_bold'
color='burnt_orange' color='burnt_orange'
title='View course details on UT Course Schedule'
> >
#{course.uniqueId} #{course.uniqueId}
</Link> </Link>
@@ -55,7 +56,13 @@ export default function CourseHeader({ course, activeSchedule, onClose }: Props)
return ( return (
<> <>
{numInstructors > 1 && index === course.instructors.length - 1 ? '& ' : ''} {numInstructors > 1 && index === course.instructors.length - 1 ? '& ' : ''}
<Link key={name} size='medium' weight='normal' url={url}> <Link
key={name}
size='medium'
weight='normal'
url={url}
title="View instructor's directory page"
>
{name} {name}
</Link> </Link>
{numInstructors > 2 && !isLast ? ', ' : ''} {numInstructors > 2 && !isLast ? ', ' : ''}
@@ -82,6 +89,7 @@ export default function CourseHeader({ course, activeSchedule, onClose }: Props)
<Link <Link
size='medium' size='medium'
weight='normal' weight='normal'
title='View building on UT Map'
url={getBuildingUrl(meeting.location?.building)} url={getBuildingUrl(meeting.location?.building)}
disabled={!meeting.location?.building} disabled={!meeting.location?.building}
> >

View File

@@ -1,7 +1,7 @@
.popup { .popup {
border-radius: 12px; border-radius: 12px;
position: relative; position: relative;
max-width: 55%; width: 55%;
overflow-y: auto; overflow-y: auto;
max-height: 90%; max-height: 90%;