mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-31 02:00:07 +02:00
49 lines
1 KiB
TypeScript
49 lines
1 KiB
TypeScript
import { ReactNode } from 'react'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import OLSpinner from '@/features/ui/components/ol/ol-spinner'
|
|
|
|
type Status = 'pending' | 'success' | 'error'
|
|
|
|
type LinkingStatusProps = {
|
|
status: Status
|
|
description: string | ReactNode
|
|
}
|
|
|
|
export default function LinkingStatus({
|
|
status,
|
|
description,
|
|
}: LinkingStatusProps) {
|
|
return (
|
|
<span>
|
|
<StatusIcon status={status} />
|
|
<span className="small"> {description}</span>
|
|
</span>
|
|
)
|
|
}
|
|
|
|
type StatusIconProps = {
|
|
status: Status
|
|
}
|
|
|
|
function StatusIcon({ status }: StatusIconProps) {
|
|
switch (status) {
|
|
case 'success':
|
|
return (
|
|
<MaterialIcon
|
|
type="check_circle"
|
|
className="settings-widget-status-icon status-success"
|
|
/>
|
|
)
|
|
case 'error':
|
|
return (
|
|
<MaterialIcon
|
|
type="cancel"
|
|
className="settings-widget-status-icon status-error"
|
|
/>
|
|
)
|
|
case 'pending':
|
|
return <OLSpinner size="sm" />
|
|
default:
|
|
return null
|
|
}
|
|
}
|