Skip to content

Commit 07061a7

Browse files
committed
indent line demo
1 parent f4bdba3 commit 07061a7

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

src/components/Console.tsx

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,23 @@ export const Console: React.FC<Props> = () => {
152152
<IndentContainer>
153153
{indentOptions.map((indentOption) => {
154154
const spaceNum = +indentOption.label.replace(/[^0-9]/g, '') - 1;
155-
return [...Array(spaceNum + 1)].map(() => {
155+
return [...Array(spaceNum + 1)].map((i) => {
156156
return (
157-
<>
158-
<IndentRow spaceNum={spaceNum * 0.8}>
157+
<Row key={i}>
158+
{[...Array(spaceNum)].map((j) => {
159+
return (
160+
<VerticalLineIndentContainer key={j}>
161+
{indentColoring && <VerticalLine />}
162+
<Indent isGey={indentColoring} />
163+
</VerticalLineIndentContainer>
164+
);
165+
})}
166+
<IndentContent>
159167
{indentOption.value}
160168
&nbsp;&nbsp;&nbsp;
161169
{indentOption.label}
162-
</IndentRow>
163-
</>
170+
</IndentContent>
171+
</Row>
164172
);
165173
});
166174
})}
@@ -189,7 +197,7 @@ const TitleWrapper = styled.div`
189197
const Title = styled.div`
190198
font-size: 16px;
191199
text-align: left;
192-
margin: 12px 10px;
200+
margin: 10px 10px;
193201
`;
194202

195203
const SwitchLabel = styled.label`
@@ -203,14 +211,46 @@ const Label = styled.div`
203211
margin-left: 12px;
204212
`;
205213

214+
const VerticalLineIndentContainer = styled.div`
215+
position: relative;
216+
`;
217+
218+
const VerticalLine = styled.div`
219+
width: 0.2px;
220+
height: 27px;
221+
position: absolute;
222+
top: -40%;
223+
left: 52%;
224+
background-color: #dcdcdc;
225+
`;
226+
227+
const Indent = styled.div<{ isGey: boolean }>`
228+
width: 20px;
229+
height: 15px;
230+
background-color: ${(props) => (props.isGey ? '#f5f5f5' : '#fff')};
231+
`;
232+
233+
const Row = styled.div`
234+
display: flex;
235+
align-items: center;
236+
`;
237+
206238
const IndentContainer = styled.div`
207239
margin: 0px 10px;
208240
`;
209241

210242
const IndentRow = styled.div<{ spaceNum: number }>`
211243
margin-left: ${(props) => `${props.spaceNum * 30}px`};
212-
margin-top: 6px;
213-
margin-bottom: 6px;
244+
margin-top: 4px;
245+
margin-bottom: 4px;
246+
display: flex;
247+
align-items: center;
248+
`;
249+
250+
const IndentContent = styled.div`
251+
margin-left: 5px;
252+
margin-top: 4px;
253+
margin-bottom: 4px;
214254
display: flex;
215255
align-items: center;
216256
`;

0 commit comments

Comments
 (0)