File component use Link
This commit is contained in:
1 parent
69904cd2dd
commit
53bdc44065
1 file changed
+11
-6
@@ -2,6 +2,7 @@ import s from './styles.module.css'
|
||||
|
||||
import { FileDefinition } from 'src/types'
|
||||
import { ext, size } from 'src/lib/file'
|
||||
import Link from 'next/link'
|
||||
|
||||
export type FileProps = FileDefinition & {
|
||||
style?: React.CSSProperties
|
||||
@@ -11,17 +12,21 @@ export const File: React.SFC<FileProps> = props => (
|
||||
<div className={s.file} style={props.style}>
|
||||
{!props.cover?.src ? null : (
|
||||
<div className={s.image}>
|
||||
<a href={props.file.src} target="_blank" className="invisible">
|
||||
<img src={props.cover.src} alt={props.name} />
|
||||
</a>
|
||||
<Link href={props.file.src} >
|
||||
<a target="_blank" rel="noreferrer" className="invisible">
|
||||
<img src={props.cover.src} alt={props.name} />
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={s.info}>
|
||||
<span>{props.name}</span>
|
||||
<a href={props.file.src} target="_blank">
|
||||
{ext(props.file.type)} ({size(props.file.size)})
|
||||
</a>
|
||||
<Link href={props.file.src} >
|
||||
<a target="_blank" rel="noreferrer">
|
||||
{ext(props.file.type)} ({size(props.file.size)})
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
Reference in new issue
Block a user