Skip to content

Commit 92ca70a

Browse files
committed
refactor: switch Editor to BEM
1 parent 83bbea5 commit 92ca70a

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
.editor-wrapper {
2-
display: flex;
3-
flex-direction: column;
4-
height: 100%;
5-
width: 100%;
6-
}
1+
.editor {
2+
&__wrapper {
3+
display: flex;
4+
flex-direction: column;
5+
height: 100%;
6+
width: 100%;
7+
}
78

8-
.editor-toolbar {
9-
display: flex;
10-
justify-content: right;
11-
padding: 8px;
12-
background-color: #1e1e1e;
13-
border-bottom: 1px solid #333;
14-
}
9+
&__toolbar {
10+
display: flex;
11+
justify-content: right;
12+
padding: 8px;
13+
background-color: #1e1e1e;
14+
border-bottom: 1px solid #333;
15+
}
1516

16-
.language-selector {
17-
margin-right: 10px;
17+
&__language-selector {
18+
margin-right: 10px;
19+
}
1820

19-
.language-select {
21+
&__language-select {
2022
background-color: #252526;
2123
color: #cccccc;
2224
border: 1px solid #3c3c3c;
@@ -35,8 +37,8 @@
3537
color: #cccccc;
3638
}
3739
}
38-
}
3940

40-
.monaco-editor-container {
41-
flex: 1;
41+
&__container {
42+
flex: 1;
43+
}
4244
}

src/frontend/src/pad/editors/Editor.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const Editor: React.FC<EditorProps> = ({
3333
onChange,
3434
onMount,
3535
onLanguageChange,
36-
className = 'monaco-editor-container',
36+
className = 'editor__container',
3737
showLanguageSelector = true,
3838
element,
3939
excalidrawAPI,
@@ -260,7 +260,7 @@ const Editor: React.FC<EditorProps> = ({
260260
};
261261

262262
return (
263-
<div className="editor-wrapper">
263+
<div className="editor__wrapper">
264264
<MonacoEditor
265265
height={height}
266266
language={currentLanguage}
@@ -272,10 +272,11 @@ const Editor: React.FC<EditorProps> = ({
272272
className={className}
273273
/>
274274
{showLanguageSelector && (
275-
<div className="editor-toolbar">
275+
<div className="editor__toolbar">
276276
<LanguageSelector
277277
value={currentLanguage}
278-
onChange={handleLanguageChange}
278+
onChange={handleLanguageChange}
279+
className="editor__language-selector"
279280
/>
280281
</div>
281282
)}

src/frontend/src/pad/editors/LanguageSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ const languageOptions = [
105105
const LanguageSelector: React.FC<LanguageSelectorProps> = ({
106106
value,
107107
onChange,
108-
className = 'language-selector'
108+
className = 'editor__language-selector'
109109
}) => {
110110
return (
111111
<div className={className}>
112112
<select
113113
value={value}
114114
onChange={(e) => onChange(e.target.value)}
115-
className="language-select"
115+
className="editor__language-select"
116116
>
117117
{languageOptions.map((option) => (
118118
<option

0 commit comments

Comments
 (0)