Skip to content

Commit 6645fd6

Browse files
committed
refactor: switch HtmlEditor to BEM
1 parent 92ca70a commit 6645fd6

File tree

2 files changed

+48
-54
lines changed

2 files changed

+48
-54
lines changed

src/frontend/src/pad/editors/HtmlEditor.scss

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,56 @@
1-
.html-editor-container {
2-
display: flex;
3-
position: relative;
4-
5-
width: 100%;
6-
height: 100%;
7-
8-
flex-direction: column;
9-
box-sizing: border-box;
10-
padding: 32px;
11-
12-
font-family: sans-serif;
13-
14-
background: #2d2d2d;
15-
color: #e0e0e0;
16-
17-
border-radius: 4px;
18-
border: 1px solid #484848;
19-
}
20-
21-
.html-editor-content {
22-
width: 100%;
23-
height: 100%;
24-
25-
display: flex;
26-
flex-direction: column;
27-
position: relative;
28-
}
29-
30-
.monaco-editor-container {
31-
width: 100%;
32-
position: relative;
1+
.html-editor {
2+
&__container {
3+
display: flex;
4+
position: relative;
5+
width: 100%;
6+
height: 100%;
7+
flex-direction: column;
8+
box-sizing: border-box;
9+
padding: 32px;
10+
font-family: sans-serif;
11+
background: #2d2d2d;
12+
color: #e0e0e0;
13+
border-radius: 4px;
14+
border: 1px solid #484848;
15+
}
3316

34-
flex: 1;
35-
min-height: 0;
36-
37-
border: 1px solid #484848;
38-
border-radius: 4px;
39-
margin-bottom: 10px;
40-
}
17+
&__content {
18+
width: 100%;
19+
height: 100%;
20+
display: flex;
21+
flex-direction: column;
22+
position: relative;
23+
}
4124

42-
.html-editor-controls {
43-
position: relative;
25+
&__monaco-container {
26+
width: 100%;
27+
position: relative;
28+
flex: 1;
29+
min-height: 0;
30+
border: 1px solid #484848;
31+
border-radius: 4px;
32+
margin-bottom: 10px;
33+
}
4434

45-
display: flex;
46-
justify-content: space-between;
47-
align-items: center;
48-
padding: 8px 0;
49-
width: 100%;
50-
flex-shrink: 0;
35+
&__controls {
36+
position: relative;
37+
display: flex;
38+
justify-content: space-between;
39+
align-items: center;
40+
padding: 8px 0;
41+
width: 100%;
42+
flex-shrink: 0;
43+
}
5144

52-
label {
45+
&__label {
5346
font-size: 12px;
5447
color: #e0e0e0;
5548
display: flex;
5649
align-items: center;
5750
gap: 4px;
5851
}
5952

60-
button {
53+
&__button {
6154
padding: 6px 12px;
6255
background: #5294f6;
6356
color: white;

src/frontend/src/pad/editors/HtmlEditor.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export const HtmlEditor: React.FC<HtmlEditorProps> = ({
9494
};
9595

9696
return (
97-
<div className="html-editor-container">
98-
<div className="html-editor-content">
97+
<div className="html-editor__container">
98+
<div className="html-editor__content">
9999
<Editor
100100
height="100%"
101101
language="html"
@@ -105,17 +105,18 @@ export const HtmlEditor: React.FC<HtmlEditorProps> = ({
105105
element={element}
106106
excalidrawAPI={excalidrawAPI}
107107
showLanguageSelector={false}
108+
className="html-editor__monaco-container"
108109
/>
109-
<div className="html-editor-controls">
110-
<label>
110+
<div className="html-editor__controls">
111+
<label className="html-editor__label">
111112
<input
112113
type="checkbox"
113114
checked={createNew}
114115
onChange={(e) => setCreateNew(e.target.checked)}
115116
/>
116117
Create new element
117118
</label>
118-
<button onClick={applyHtml}>
119+
<button className="html-editor__button" onClick={applyHtml}>
119120
Apply HTML
120121
</button>
121122
</div>

0 commit comments

Comments
 (0)