git ssb

16+

Dominic / patchbay



Commit 62369139dea25ef969beb858347af6351ee46780

move -expanded to top level Compose class => nice refactors

mix irving committed on 1/11/2017, 2:37:32 AM
Parent: a7f008995a10dc690974348caecbec007e36228b

Files changed

modules_basic/compose.jschanged
modules_basic/compose.mcsschanged
modules_basic/compose.jsView
@@ -53,29 +53,26 @@
5353
5454 var actions
5555
5656 var textArea = h('textarea', {
57- placeholder: opts.placeholder || 'Write a message',
58- className: opts.shrink === false ? '-expanded' : '-contracted'
57 + placeholder: opts.placeholder || 'Write a message'
5958 })
6059
6160 if(opts.shrink !== false) {
6261 var blur
6362 textArea.addEventListener('focus', () => {
6463 clearTimeout(blur)
6564 if(!textArea.value) {
66- textArea.className = '-expanded'
65 + composer.className = 'Compose -expanded'
6766 }
68- actions.style.display = 'flex'
6967 })
7068 textArea.addEventListener('blur', () => {
7169 //don't shrink right away, so there is time
7270 //to click the publish button.
7371 clearTimeout(blur)
7472 blur = setTimeout(() => {
7573 if(textArea.value) return
76- textArea.className = '-contracted'
77- actions.style.display = 'none'
74 + composer.className = 'Compose -contracted'
7875 }, 300)
7976 })
8077 }
8178
@@ -131,15 +128,15 @@
131128 textArea.value += '\n' + embed + '['+file.name+']('+file.link+')'
132129 console.log('added:', file)
133130 })
134131 var publishBtn = h('button', {'ev-click': publish}, 'Publish' )
135- var actions = h('section.actions',
136- //hidden until you focus the textarea
137- { style: {display: opts.shrink === false ? '' : 'none'} },
138- [ fileInput, publishBtn ]
139- )
132 + var actions = h('section.actions', [
133 + fileInput, publishBtn
134 + ])
140135
141- var composer = h('Compose', [
136 + var composer = h('Compose', {
137 + className: opts.shrink === false ? '-expanded' : '-contracted'
138 + }, [
142139 textArea,
143140 actions
144141 ])
145142
modules_basic/compose.mcssView
@@ -5,18 +5,8 @@
55 padding: 1rem .5rem 1rem 7.3rem
66
77 textarea {
88 border: 1px solid gainsboro
9-
10- -expanded {
11- height: 200px
12- transition: height .15s ease-out
13- }
14-
15- -contracted {
16- height: 50px
17- transition: height .15s ease-in
18- }
199 }
2010
2111 section.actions {
2212 display: flex
@@ -62,8 +52,31 @@
6252 font-weight: bold
6353 font-size: .7rem
6454 }
6555 }
56 +
57 + -expanded {
58 + textarea {
59 + height: 200px
60 + transition: height .15s ease-out
61 + }
62 +
63 + section.actions {
64 + display: flex
65 + }
66 + }
67 +
68 + -contracted {
69 + textarea {
70 + height: 50px
71 + transition: height .15s ease-in
72 + }
73 +
74 + section.actions {
75 + display: none
76 + }
77 + }
78 +
6679 }
6780
6881 $composeButton {
6982 background: #fff

Built with git-ssb-web