@@ -10,6 +10,7 @@ import Icon from 'js/ui/components/atomic/icon';
10
10
import Flex from 'js/ui/components/layout/flex' ;
11
11
12
12
type ImageUploadProps = {
13
+ compact ?: boolean ;
13
14
className ?: string ;
14
15
height ?: number ;
15
16
onUpload ?: ( name : string , base : string ) => void ;
@@ -30,8 +31,12 @@ export default (): m.Component<ImageUploadProps> => {
30
31
'label.pointer.db.h-100.w-100.ba.bw1.br2.b--dashed.b--col-primary-muted.bg-black-05' ,
31
32
{ style : { height : attrs . height ? attrs . height + 'px' : '250px' } , for : id } ,
32
33
[
33
- m ( Flex , { className : '.w-100.h-100' , justify : 'center' , items : 'center' , direction : 'column' } , [
34
- m ( Icon , { icon : 'document' , size : 2 , className : '.mb3' } ) ,
34
+ m ( Flex , { className : '.w-100.h-100' , justify : 'center' , items : 'center' , direction : attrs . compact ? 'row' : 'column' } , [
35
+ m ( Icon , {
36
+ icon : 'document' ,
37
+ size : attrs . compact ? 4 : 2 ,
38
+ className : attrs . compact ? '.mr3' : '.mb3' ,
39
+ } ) ,
35
40
m ( 'div.fw5' , 'Select image from your computer' ) ,
36
41
] ) , //
37
42
] ,
@@ -59,17 +64,17 @@ export default (): m.Component<ImageUploadProps> => {
59
64
} ) ,
60
65
//
61
66
// Divider
62
- m ( Icon , { icon : 'more' , size : 3 , className : '.mv3.o-50' } ) ,
67
+ attrs . compact ? m ( 'div.mb2' ) : m ( Icon , { icon : 'more' , size : 3 , className : '.mv3.o-50' } ) ,
63
68
//
64
69
// Upload from URL
65
- m ( 'div.db.h-100.w-100.ba.bw1.br2.b--dashed.b--col-primary-muted.bg-black-05. pa3' , [
70
+ m ( 'div.db.h-100.w-100.ba.bw1.br2.b--dashed.b--col-primary-muted.bg-black-05' + ( attrs . compact ? '.pa2' : '. pa3') , [
66
71
m ( 'div.tc.mb3.fw5' , 'Download from URL' ) ,
67
- m ( Flex , [
72
+ m ( Flex , { direction : attrs . compact ? 'column' : 'row' } , [
68
73
m ( Input , { className : '.w-100' , placeholder : 'https://example.com/image.png' , value : url } ) , //
69
74
m (
70
75
Button ,
71
76
{
72
- className : '.ml2' ,
77
+ className : attrs . compact ? '.mt2' : '.ml2' ,
73
78
intend : 'primary' ,
74
79
onClick : ( ) => {
75
80
if ( url . length === 0 ) return ;
0 commit comments