Skip to content

Commit 83d38f5

Browse files
committed
set toggle
1 parent 5afcdec commit 83d38f5

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"react-icons": "^4.3.1",
3434
"react-scripts": "4.0.3",
3535
"react-select": "^5.2.1",
36+
"react-switch": "^6.0.0",
3637
"styled-components": "^5.3.3",
3738
"web-vitals": "^1.0.1"
3839
},

src/components/Console.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import Select, { ActionMeta, SingleValue } from 'react-select';
3+
import Switch from 'react-switch';
34
import styled from 'styled-components';
45

56
const options = [
@@ -78,7 +79,26 @@ export const Console: React.FC<Props> = () => {
7879

7980
return (
8081
<MainContainer>
81-
<Title>Select Favorite List Maker</Title>
82+
<TitleWrapper>
83+
<Title>Select Favorite List Maker</Title>
84+
<SwitchLabel>
85+
<Switch
86+
checked={true}
87+
onChange={() => {
88+
console.log('aaa');
89+
}}
90+
onColor="#00b428"
91+
boxShadow="0px 1px 5px rgba(0, 0, 0, 0.6)"
92+
height={16}
93+
width={28}
94+
handleDiameter={18}
95+
checkedIcon={false}
96+
uncheckedIcon={false}
97+
/>
98+
<Spacer width={6} />
99+
<span>Indent Coloring</span>
100+
</SwitchLabel>
101+
</TitleWrapper>
82102
<IndentContainer>
83103
{indentOptions.map((indentOption) => {
84104
const spaceNum = +indentOption.label.replace(/[^0-9]/g, '') - 1;
@@ -102,7 +122,6 @@ export const Console: React.FC<Props> = () => {
102122
);
103123
})}
104124
</IndentContainer>
105-
106125
<DemonstrationContainer>
107126
<Demonstration>
108127
<Title>Demonstration</Title>
@@ -134,12 +153,27 @@ const MainContainer = styled.div`
134153
padding-bottom: 8px;
135154
`;
136155

156+
const Spacer = styled.div<{ width: number }>`
157+
width: ${(props) => props.width}px;
158+
`;
159+
160+
const TitleWrapper = styled.div`
161+
display: flex;
162+
align-items: center;
163+
`;
164+
137165
const Title = styled.div`
138166
font-size: 16px;
139167
text-align: left;
140168
margin: 12px 10px;
141169
`;
142170

171+
const SwitchLabel = styled.label`
172+
margin-left: 8px;
173+
display: flex;
174+
align-items: center;
175+
`;
176+
143177
const Label = styled.div`
144178
font-size: 14px;
145179
margin-left: 12px;

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9543,6 +9543,13 @@ react-select@*, react-select@^5.2.1:
95439543
prop-types "^15.6.0"
95449544
react-transition-group "^4.3.0"
95459545

9546+
react-switch@^6.0.0:
9547+
version "6.0.0"
9548+
resolved "https://registry.yarnpkg.com/react-switch/-/react-switch-6.0.0.tgz#bd4a2dea08f211b8a32e55e8314fd44bc1ec947e"
9549+
integrity sha512-QV3/6eRK5/5epdQzIqvDAHRoGLbCv/wDpHUi6yBMXY1Xco5XGuIZxvB49PHoV1v/SpEgOCJLD/Zo43iic+aEIw==
9550+
dependencies:
9551+
prop-types "^15.7.2"
9552+
95469553
react-transition-group@^4.3.0:
95479554
version "4.4.2"
95489555
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.2.tgz#8b59a56f09ced7b55cbd53c36768b922890d5470"

0 commit comments

Comments
 (0)