components uses css modules; other refactoring
This commit is contained in:
1 parent
0cd61e0ed9
commit
d65aba19a0
28 files changed
+137
-94
No files matched your search
@@ -1,27 +1,27 @@
|
||||
import './styles.css'
|
||||
import s from './styles.module.css'
|
||||
|
||||
import { FileDefinition } from 'src/types'
|
||||
import { ext, size } from 'src/lib/file'
|
||||
import { titleCase } from 'src/lib/string'
|
||||
|
||||
export const File: React.SFC<FileDefinition> = props => (
|
||||
<div className={'file'}>
|
||||
<h1>{titleCase(props.name)}</h1>
|
||||
export type FileProps = FileDefinition & {
|
||||
style?: React.CSSProperties
|
||||
}
|
||||
|
||||
export const File: React.SFC<FileProps> = props => (
|
||||
<div className={s.file} style={props.style}>
|
||||
{!props.cover?.src ? null : (
|
||||
<div className={'file__image'}>
|
||||
<div className={s.image}>
|
||||
<a href={props.file.src} target="_blank" className="invisible">
|
||||
<img src={props.cover.src} alt={props.name} />
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={'file__file'}>
|
||||
<span>{titleCase(props.name)}</span>
|
||||
</div>
|
||||
|
||||
<div className={'file__file-info'}>
|
||||
<a href={props.file.src} target="_blank">{ext(props.file.name)} ({size(props.file.size)})</a>
|
||||
<div className={s.info}>
|
||||
<span>{props.name}</span>
|
||||
<a href={props.file.src} target="_blank">
|
||||
{ext(props.file.type)} ({size(props.file.size)})
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -6,20 +6,24 @@
|
||||
margin-bottom: var(--size-xl);
|
||||
}
|
||||
|
||||
.file__image {
|
||||
.image {
|
||||
margin-bottom: var(--size-m);
|
||||
}
|
||||
|
||||
.file__image img {
|
||||
.image img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.file__image--big {
|
||||
max-width: 20em;
|
||||
}
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.file__file-info {
|
||||
font-size: var(--font-size-second);
|
||||
}
|
||||
|
||||
.info span {
|
||||
padding-bottom: var(--size-m);
|
||||
}
|
||||
Reference in new issue
Block a user