File tree Expand file tree Collapse file tree 7 files changed +87
-56
lines changed Expand file tree Collapse file tree 7 files changed +87
-56
lines changed Original file line number Diff line number Diff line change
1
+ @import " ../utils/mixins.scss" ;
2
+
1
3
.ch-code-browser {
2
4
display : flex ;
3
5
height : 100% ;
45
47
}
46
48
47
49
.ch-code-browser-button {
50
+ @include button-reset ;
51
+
48
52
width : 1.5em ;
49
53
height : 1.5em ;
50
- cursor : pointer ;
51
54
min-width : 1.5em ;
52
55
min-height : 1.5em ;
53
56
position : absolute ;
Original file line number Diff line number Diff line change
1
+ @import " ../utils/mixins.scss" ;
2
+
1
3
.ch-no-scroll {
2
4
overflow : hidden ;
3
5
}
15
17
}
16
18
17
19
.ch-expand-close {
20
+ @include button-reset ;
21
+
18
22
position : absolute ;
19
23
top : 10px ;
20
24
right : 10px ;
21
- cursor : pointer ;
22
25
color : white ;
23
26
width : 26px ;
24
27
height : 26px ;
Original file line number Diff line number Diff line change @@ -94,44 +94,50 @@ function ExpandIcon({
94
94
className ?: string
95
95
} ) {
96
96
return (
97
- < svg
97
+ < button
98
+ type = "button"
99
+ title = "Expand"
98
100
style = { style }
99
101
onClick = { onClick }
100
102
className = { className }
101
- fill = "none"
102
- stroke = "currentColor"
103
- viewBox = "0 0 24 24"
104
- xmlns = "http://www.w3.org/2000/svg"
105
- role = "button"
106
103
>
107
- < title > Expand</ title >
108
- < path
109
- strokeLinecap = "round"
110
- strokeLinejoin = "round"
111
- strokeWidth = { 2 }
112
- d = "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"
113
- />
114
- </ svg >
104
+ < svg
105
+ fill = "none"
106
+ stroke = "currentColor"
107
+ viewBox = "0 0 24 24"
108
+ xmlns = "http://www.w3.org/2000/svg"
109
+ >
110
+ < path
111
+ strokeLinecap = "round"
112
+ strokeLinejoin = "round"
113
+ strokeWidth = { 2 }
114
+ d = "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"
115
+ />
116
+ </ svg >
117
+ </ button >
115
118
)
116
119
}
117
120
function CloseButton ( { onClick } : { onClick : ( ) => void } ) {
118
121
return (
119
- < svg
122
+ < button
120
123
onClick = { onClick }
121
124
className = "ch-expand-close"
122
- fill = "none"
123
- stroke = "currentColor"
124
- viewBox = "0 0 24 24"
125
- xmlns = "http://www.w3.org/2000/svg"
126
- role = "button"
125
+ type = "button"
126
+ title = "Close"
127
127
>
128
- < title > Close</ title >
129
- < path
130
- strokeLinecap = "round"
131
- strokeLinejoin = "round"
132
- strokeWidth = { 2 }
133
- d = "M6 18L18 6M6 6l12 12"
134
- />
135
- </ svg >
128
+ < svg
129
+ fill = "none"
130
+ stroke = "currentColor"
131
+ viewBox = "0 0 24 24"
132
+ xmlns = "http://www.w3.org/2000/svg"
133
+ >
134
+ < path
135
+ strokeLinecap = "round"
136
+ strokeLinejoin = "round"
137
+ strokeWidth = { 2 }
138
+ d = "M6 18L18 6M6 6l12 12"
139
+ />
140
+ </ svg >
141
+ </ button >
136
142
)
137
143
}
Original file line number Diff line number Diff line change 3
3
@import " ../smooth-code/index.scss" ;
4
4
@import " ./dialog.scss" ;
5
5
@import " ./code-browser.scss" ;
6
+ @import " ../utils/mixins.scss" ;
6
7
7
8
/* * tabs */
8
9
96
97
}
97
98
98
99
.ch-editor-button {
100
+ @include button-reset ;
101
+
99
102
width : 1.5em ;
100
103
height : 1.5em ;
101
- cursor : pointer ;
102
104
min-width : 1.5em ;
103
105
min-height : 1.5em ;
104
106
margin-right : 0.8em ;
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ export function CopyButton({
12
12
const [ copied , setCopied ] = React . useState ( false )
13
13
14
14
return (
15
- < svg
15
+ < button
16
+ type = "button"
17
+ title = "Copy code"
18
+ className = { className }
16
19
style = { style }
17
20
onClick = { ( ) => {
18
21
copyToClipboard ( content )
@@ -21,30 +24,30 @@ export function CopyButton({
21
24
setCopied ( false )
22
25
} , 1200 )
23
26
} }
24
- fill = "none"
25
- stroke = "currentColor"
26
- viewBox = "0 0 24 24"
27
- xmlns = "http://www.w3.org/2000/svg"
28
- className = { className }
29
27
>
30
- < title > Copy</ title >
31
-
32
- { copied ? (
33
- < path
34
- strokeLinecap = "round"
35
- strokeLinejoin = "round"
36
- strokeWidth = { 2 }
37
- d = "M5 13l4 4L19 7"
38
- />
39
- ) : (
40
- < path
41
- strokeLinecap = "round"
42
- strokeLinejoin = "round"
43
- strokeWidth = "1.6px"
44
- d = "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
45
- />
46
- ) }
47
- </ svg >
28
+ < svg
29
+ fill = "none"
30
+ stroke = "currentColor"
31
+ viewBox = "0 0 24 24"
32
+ xmlns = "http://www.w3.org/2000/svg"
33
+ >
34
+ { copied ? (
35
+ < path
36
+ strokeLinecap = "round"
37
+ strokeLinejoin = "round"
38
+ strokeWidth = { 2 }
39
+ d = "M5 13l4 4L19 7"
40
+ />
41
+ ) : (
42
+ < path
43
+ strokeLinecap = "round"
44
+ strokeLinejoin = "round"
45
+ strokeWidth = "1.6px"
46
+ d = "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
47
+ />
48
+ ) }
49
+ </ svg >
50
+ </ button >
48
51
)
49
52
}
50
53
Original file line number Diff line number Diff line change
1
+ @import " ../utils/mixins.scss" ;
2
+
1
3
.ch-code-line-number {
2
4
user-select : none ;
3
5
text-align : right ;
28
30
}
29
31
30
32
.ch-code-button {
33
+ @include button-reset ;
34
+
31
35
position : absolute ;
32
36
top : 10px ;
33
37
right : 10px ;
34
38
width : 1.1em ;
35
39
height : 1.1em ;
36
- cursor : pointer ;
37
40
}
Original file line number Diff line number Diff line change
1
+ @mixin button-reset {
2
+ -webkit-appearance : button;
3
+ background-color : transparent ;
4
+ background-image : none ;
5
+ cursor : pointer ;
6
+ color : inherit ;
7
+ margin : 0 ;
8
+ padding : 0 ;
9
+ border : none ;
10
+ font-size : inherit ;
11
+ }
You can’t perform that action at this time.
0 commit comments