fix typo in FileCard component
This commit is contained in:
1 parent
c8ccda9433
commit
c1d33cf681
5 files changed
+1
-1
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import s from "./signature.module.css"
|
||||
|
||||
import { Sign } from "@/types"
|
||||
import { HiOutlineShieldCheck } from "react-icons/hi"
|
||||
|
||||
import * as Tooltip from "@radix-ui/react-tooltip"
|
||||
|
||||
export type SignatureProps = Sign
|
||||
export const Signature: React.FC<SignatureProps> = props => {
|
||||
const content = (
|
||||
<ul className={s.signature}>
|
||||
<li>Дата и время подписания: {props.date}</li>
|
||||
<li>ФИО подписавшего документ: {props.person}</li>
|
||||
<li>Должность: {props.position}</li>
|
||||
<li>Уникальный программный ключ: {props.signature}</li>
|
||||
</ul>
|
||||
)
|
||||
|
||||
return (
|
||||
<Tooltip.Provider>
|
||||
<Tooltip.Root>
|
||||
<Tooltip.Trigger className={s.tooltipTrigger}>
|
||||
<HiOutlineShieldCheck className={s.secure} size={20} />
|
||||
</Tooltip.Trigger>
|
||||
|
||||
<Tooltip.Portal>
|
||||
<Tooltip.Content className={s.tooltip}>
|
||||
{content}
|
||||
<Tooltip.Arrow className={s.tooltipArrow} />
|
||||
</Tooltip.Content>
|
||||
</Tooltip.Portal>
|
||||
</Tooltip.Root>
|
||||
</Tooltip.Provider>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
.file {
|
||||
display: grid;
|
||||
flex-direction: row;
|
||||
|
||||
grid-template-columns: 100px auto 150px;
|
||||
gap: var(--size-m);
|
||||
|
||||
margin-bottom: var(--size-l);
|
||||
}
|
||||
|
||||
.image {
|
||||
box-shadow: var(--shadow);
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-size: var(--font-size-second);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* MOBILE */
|
||||
@media (max-width: 31.25em) {
|
||||
.file {
|
||||
grid-template-columns: 75px auto;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import s from "./filecard.module.css"
|
||||
|
||||
import Image from "next/image"
|
||||
import dynamic from "next/dynamic"
|
||||
import { FileTokenData, Sign } from "@/types"
|
||||
import { size, ext } from "@/lib/file"
|
||||
import { getResizedUrl } from "@/lib/image"
|
||||
import Link from "next/link"
|
||||
import { Box } from "@/ui/Box"
|
||||
|
||||
const Signature = dynamic(import("./Signature").then(m => m.Signature), {
|
||||
ssr: false,
|
||||
})
|
||||
|
||||
export type FileCardProps = FileTokenData & {
|
||||
sign?: Sign
|
||||
}
|
||||
|
||||
export const FileCard: React.FC<FileCardProps> = props => {
|
||||
const fileSize = size(props.file_size)
|
||||
const format = ext(props.file_format)
|
||||
|
||||
return (
|
||||
<div className={s.file}>
|
||||
<a href={props.url} className="invisible">
|
||||
<div className={s.image}>
|
||||
<Image
|
||||
className={s.image}
|
||||
loader={({ src, width, quality }) => {
|
||||
return getResizedUrl(src, {
|
||||
width,
|
||||
height: width,
|
||||
n: 1,
|
||||
})
|
||||
}}
|
||||
src={props.image_url}
|
||||
alt={""}
|
||||
width={100}
|
||||
height={100}
|
||||
/>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div>
|
||||
<Box align={false} gap={"var(--size-xs)"}>
|
||||
{!props.sign ? null : (
|
||||
<Signature
|
||||
{...props.sign}
|
||||
/>
|
||||
)}
|
||||
<Link href={props.url}>
|
||||
{props.title}
|
||||
</Link>
|
||||
</Box>
|
||||
</div>
|
||||
|
||||
<div className={s.info}>
|
||||
<Link href={props.file_url} target="_blank" rel="noreferrer">
|
||||
{format} ({fileSize})
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
.signature{
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.tooltipTrigger {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
padding: var(--size-m);
|
||||
color: var(--color-text-opposite);
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
background-color: var(--color-back-opposite);
|
||||
border-radius: var(--radius);
|
||||
min-height: 34px;
|
||||
border: none;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.tooltipArrow {
|
||||
width: var(--size-m);
|
||||
height: var(--size-s);
|
||||
|
||||
fill: var(--color-back-opposite);
|
||||
}
|
||||
Reference in new issue
Block a user