File tree Expand file tree Collapse file tree 3 files changed +14
-51
lines changed
src/browser/modules/Editor Expand file tree Collapse file tree 3 files changed +14
-51
lines changed Original file line number Diff line number Diff line change @@ -461,12 +461,6 @@ export class Editor extends Component {
461461
462462 const editorIsEmpty = this . getEditorValue ( ) . length > 0
463463 const buttons = [
464- {
465- onClick : ( ) => this . setEditorValue ( '' ) ,
466- icon : eraser2 ,
467- title : 'Clear' ,
468- disabled : editorIsEmpty
469- } ,
470464 {
471465 onClick : this . state . contentId
472466 ? ( ) =>
@@ -486,7 +480,8 @@ export class Editor extends Component {
486480 onClick : this . execCurrent ,
487481 icon : controlsPlay ,
488482 title : 'Play' ,
489- disabled : editorIsEmpty
483+ disabled : editorIsEmpty ,
484+ iconColor : this . props . theme . linkHover
490485 }
491486 ]
492487
@@ -496,7 +491,7 @@ export class Editor extends Component {
496491 return (
497492 < Bar expanded = { isFullscreen } card = { isCardSize } >
498493 < Header expanded = { isFullscreen } card = { isCardSize } >
499- < ActionButtons buttons = { buttons } />
494+ < ActionButtons width = { 15 } buttons = { buttons } />
500495 </ Header >
501496 < EditorWrapper expanded = { isFullscreen } card = { isCardSize } >
502497 < Codemirror
Original file line number Diff line number Diff line change @@ -55,27 +55,24 @@ export function EditorFrame({ bus }: EditorFrameProps) {
5555 bus . send ( SET_CONTENT , { message : '' } )
5656 }
5757
58- const fullscreenIcon = isFullscreen ? < ContractIcon /> : < ExpandIcon />
59- const expandCollapseIcon = isCardSize ? < UpIcon /> : < DownIcon />
60-
6158 const buttons = [
6259 {
6360 onClick : toggleFullscreen ,
6461 disabled : false ,
65- title : 'Fullscreen' ,
66- Icon : fullscreenIcon
62+ title : isFullscreen ? 'Close fullscreen' : 'Fullscreen' ,
63+ icon : isFullscreen ? < ContractIcon /> : < ExpandIcon />
6764 } ,
6865 {
6966 onClick : toggleCardView ,
7067 disabled : false ,
7168 title : isCardSize ? 'Collapse' : 'Cardview' ,
72- Icon : expandCollapseIcon
69+ icon : isCardSize ? < UpIcon /> : < DownIcon />
7370 } ,
7471 {
7572 onClick : clearEditor ,
7673 disabled : false ,
7774 title : 'Clear' ,
78- Icon : CloseIcon
75+ icon : < CloseIcon />
7976 }
8077 ]
8178
@@ -84,21 +81,11 @@ export function EditorFrame({ bus }: EditorFrameProps) {
8481 < FrameHeader >
8582 < FrameHeaderText > </ FrameHeaderText >
8683 < UIControls >
87- < FrameButton
88- title = { isFullscreen ? 'Close fullscreen' : 'Fullscreen' }
89- onClick = { onClick }
90- >
91- < fullscreenIcon />
92- </ FrameButton >
93- < FrameButton
94- title = { isCardSize ? 'Expand' : 'Collapse' }
95- onClick = { onClick }
96- >
97- < CloseIcon />
98- </ FrameButton >
99- < FrameButton title = { 'Reset editor' } onClick = { clearEditor } >
100- < CloseIcon />
101- </ FrameButton >
84+ { buttons . map ( ( { onClick, icon, title } ) => (
85+ < FrameButton key = { `frame-${ title } ` } title = { title } onClick = { onClick } >
86+ { icon }
87+ </ FrameButton >
88+ ) ) }
10289 </ UIControls >
10390 </ FrameHeader >
10491 {
Original file line number Diff line number Diff line change @@ -34,30 +34,12 @@ export const BaseBar = styled.div<ResizeableProps>`
3434 border-radius: 2px;
3535 // minmax(0, 1fr) prevents the editor from growing the text field
3636 grid-template-columns: minmax(0, 1fr) auto;
37- grid-template-areas: ${ ( props ) : string => {
38- if ( props . expanded || props . card ) {
39- return "'header' 'editor'"
40- }
41- return "'editor header'"
42- } } ;
37+ grid-template-areas: 'editor header';
4338`
4439
4540export const Header = styled . div < ResizeableProps > `
4641 grid-area: header;
4742 border-radius: 4px 4px 0 0;
48- ${ ( props ) : string => {
49- if ( props . expanded ) {
50- return `background-color: #4d4a57;
51- border-radius: 0;
52- `
53- }
54- if ( props . card ) {
55- return `background-color: #4d4a57;
56- transition-duration: 0.3s;`
57- }
58- return ''
59- } }
60-
6143 display: flex;
6244 justify-content: flex-end;
6345 padding-top: 7px
@@ -100,7 +82,7 @@ const BaseEditorWrapper = styled.div<ResizeableProps>`
10082 return '0'
10183 } } ;
10284
103- ${ ( props ) : string => ( props . expanded ? '' : ' transition-duration: 0.1s;' ) }
85+ transition-duration: 0.1s;
10486
10587 .CodeMirror {
10688 color: ${ ( props ) : string => props . theme . editorCommandColor } ;
@@ -124,7 +106,6 @@ export const FrameHeader = styled.div`
124106 display: flex;
125107 flex-direction: column;
126108 margin-left: 7px;
127- margin-right: 7px;
128109 height: 33px;
129110`
130111
You can’t perform that action at this time.
0 commit comments