Skip to content

Commit fa63977

Browse files
committed
chore: refactor to styled-components
1 parent 1ebb3c6 commit fa63977

File tree

4 files changed

+142
-121
lines changed

4 files changed

+142
-121
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@
3939
"lint": "eslint . --ext .js,.ts,.tsx"
4040
},
4141
"peerDependencies": {
42-
"react": ">=16.0.0"
42+
"react": ">=16.0.0",
43+
"styled-components": ">=5.0.0"
4344
},
4445
"devDependencies": {
4546
"@babel/plugin-transform-react-jsx-self": "^7.16.7",
4647
"@babel/plugin-transform-react-jsx-source": "^7.16.7",
47-
"@emotion/react": "^11.8.2",
48-
"@emotion/styled": "^11.8.1",
4948
"@testing-library/jest-dom": "^5.16.3",
5049
"@testing-library/react": "^13.0.0",
5150
"@testing-library/user-event": "^14.0.4",
5251
"@types/jest": "^27.4.1",
5352
"@types/node": "^17.0.23",
5453
"@types/react": "^17.0.43",
5554
"@types/react-dom": "^17.0.14",
55+
"@types/styled-components": "^5.1.24",
5656
"@typescript-eslint/eslint-plugin": "^5.18.0",
5757
"@typescript-eslint/parser": "^5.18.0",
5858
"babel-eslint": "^10.0.3",

src/index.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import { Global, css } from '@emotion/react';
32
import * as S from './styles';
43

54
const KEY_CODE = {
@@ -178,15 +177,7 @@ const ReactInputVerificationCode = ({
178177

179178
return (
180179
<React.Fragment>
181-
<Global
182-
styles={css`
183-
:root {
184-
--ReactInputVerificationCode-itemWidth: 4.5rem;
185-
--ReactInputVerificationCode-itemHeight: 5rem;
186-
--ReactInputVerificationCode-itemSpacing: 1rem;
187-
}
188-
`}
189-
/>
180+
<S.GlobalStyle />
190181

191182
<S.Container
192183
className='ReactInputVerificationCode__container'

src/styles.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import styled from '@emotion/styled';
1+
import styled, { createGlobalStyle } from 'styled-components';
2+
3+
export const GlobalStyle = createGlobalStyle`
4+
:root {
5+
--ReactInputVerificationCode-itemWidth: 4.5rem;
6+
--ReactInputVerificationCode-itemHeight: 5rem;
7+
--ReactInputVerificationCode-itemSpacing: 1rem;
8+
}
9+
`;
210

311
interface ContainerProps {
412
itemsCount: number;

0 commit comments

Comments
 (0)