mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
alerts: use shorthand return
This commit is contained in:
committed by
David Lechner
parent
95199e44c1
commit
9fe62467d5
@@ -17,11 +17,9 @@ const BluetoothNotAvailable: React.VoidFunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const bluetoothNotAvailable: CreateToast = (onAction) => {
|
||||
return {
|
||||
message: <BluetoothNotAvailable />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
export const bluetoothNotAvailable: CreateToast = (onAction) => ({
|
||||
message: <BluetoothNotAvailable />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
@@ -25,11 +25,9 @@ const MissingService: React.VoidFunctionComponent<MissingServiceProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const missingService: CreateToast<MissingServiceProps> = (onAction, props) => {
|
||||
return {
|
||||
message: <MissingService {...props} />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
export const missingService: CreateToast<MissingServiceProps> = (onAction, props) => ({
|
||||
message: <MissingService {...props} />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
@@ -11,11 +11,9 @@ const NoGatt: React.VoidFunctionComponent = () => {
|
||||
return <p>{i18n.translate('noGatt.message')}</p>;
|
||||
};
|
||||
|
||||
export const noGatt: CreateToast = (onAction) => {
|
||||
return {
|
||||
message: <NoGatt />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
export const noGatt: CreateToast = (onAction) => ({
|
||||
message: <NoGatt />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
@@ -45,12 +45,10 @@ const NoHub: React.VoidFunctionComponent<NoHubProps> = ({ onFlashFirmware }) =>
|
||||
);
|
||||
};
|
||||
|
||||
export const noHub: CreateToast<never, 'dismiss' | 'flashFirmware'> = (onAction) => {
|
||||
return {
|
||||
message: <NoHub onFlashFirmware={() => onAction('flashFirmware')} />,
|
||||
icon: 'info-sign',
|
||||
intent: Intent.PRIMARY,
|
||||
timeout: 15000,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
export const noHub: CreateToast<never, 'dismiss' | 'flashFirmware'> = (onAction) => ({
|
||||
message: <NoHub onFlashFirmware={() => onAction('flashFirmware')} />,
|
||||
icon: 'info-sign',
|
||||
intent: Intent.PRIMARY,
|
||||
timeout: 15000,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
@@ -39,11 +39,9 @@ const NoWebBluetooth: React.VoidFunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const noWebBluetooth: CreateToast = (onAction) => {
|
||||
return {
|
||||
message: <NoWebBluetooth />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
export const noWebBluetooth: CreateToast = (onAction) => ({
|
||||
message: <NoWebBluetooth />,
|
||||
icon: 'error',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
@@ -30,11 +30,9 @@ const OldFirmware: React.VoidFunctionComponent<OldFirmwareProps> = ({
|
||||
|
||||
export const oldFirmware: CreateToast<never, 'dismiss' | 'flashFirmware'> = (
|
||||
onAction,
|
||||
) => {
|
||||
return {
|
||||
message: <OldFirmware onFlashFirmware={() => onAction('flashFirmware')} />,
|
||||
icon: 'info-sign',
|
||||
intent: Intent.PRIMARY,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
};
|
||||
};
|
||||
) => ({
|
||||
message: <OldFirmware onFlashFirmware={() => onAction('flashFirmware')} />,
|
||||
icon: 'info-sign',
|
||||
intent: Intent.PRIMARY,
|
||||
onDismiss: () => onAction('dismiss'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user