Upgrade linter and formatter to Ultracite (#1224)
This commit is contained in:
parent
b1d254283b
commit
0e320b391d
177 changed files with 6951 additions and 8342 deletions
|
|
@ -1,18 +1,18 @@
|
|||
'use client';
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useRef, useState, type ReactNode } from 'react';
|
||||
import { toast as sonnerToast } from 'sonner';
|
||||
import { CheckCircleFillIcon, WarningIcon } from './icons';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { toast as sonnerToast } from "sonner";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckCircleFillIcon, WarningIcon } from "./icons";
|
||||
|
||||
const iconsByType: Record<'success' | 'error', ReactNode> = {
|
||||
const iconsByType: Record<"success" | "error", ReactNode> = {
|
||||
success: <CheckCircleFillIcon />,
|
||||
error: <WarningIcon />,
|
||||
};
|
||||
|
||||
export function toast(props: Omit<ToastProps, 'id'>) {
|
||||
export function toast(props: Omit<ToastProps, "id">) {
|
||||
return sonnerToast.custom((id) => (
|
||||
<Toast id={id} type={props.type} description={props.description} />
|
||||
<Toast description={props.description} id={id} type={props.type} />
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -24,7 +24,9 @@ function Toast(props: ToastProps) {
|
|||
|
||||
useEffect(() => {
|
||||
const el = descriptionRef.current;
|
||||
if (!el) return;
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
|
||||
const update = () => {
|
||||
const lineHeight = Number.parseFloat(getComputedStyle(el).lineHeight);
|
||||
|
|
@ -37,28 +39,28 @@ function Toast(props: ToastProps) {
|
|||
ro.observe(el);
|
||||
|
||||
return () => ro.disconnect();
|
||||
}, [description]);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex toast-mobile:w-[356px] w-full justify-center">
|
||||
<div
|
||||
className={cn(
|
||||
"flex toast-mobile:w-fit w-full flex-row gap-3 rounded-lg bg-zinc-100 p-3",
|
||||
multiLine ? "items-start" : "items-center"
|
||||
)}
|
||||
data-testid="toast"
|
||||
key={id}
|
||||
className={cn(
|
||||
'flex toast-mobile:w-fit w-full flex-row gap-3 rounded-lg bg-zinc-100 p-3',
|
||||
multiLine ? 'items-start' : 'items-center',
|
||||
)}
|
||||
>
|
||||
<div
|
||||
data-type={type}
|
||||
className={cn(
|
||||
'data-[type=error]:text-red-600 data-[type=success]:text-green-600',
|
||||
{ 'pt-1': multiLine },
|
||||
"data-[type=error]:text-red-600 data-[type=success]:text-green-600",
|
||||
{ "pt-1": multiLine }
|
||||
)}
|
||||
data-type={type}
|
||||
>
|
||||
{iconsByType[type]}
|
||||
</div>
|
||||
<div ref={descriptionRef} className="text-sm text-zinc-950">
|
||||
<div className="text-sm text-zinc-950" ref={descriptionRef}>
|
||||
{description}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -66,8 +68,8 @@ function Toast(props: ToastProps) {
|
|||
);
|
||||
}
|
||||
|
||||
interface ToastProps {
|
||||
type ToastProps = {
|
||||
id: string | number;
|
||||
type: 'success' | 'error';
|
||||
type: "success" | "error";
|
||||
description: string;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue