Skip to content

Commit 1ec6cf9

Browse files
refactor: migrate from @emotion/react to @emotion/styled
1 parent 747924a commit 1ec6cf9

File tree

5 files changed

+42
-54
lines changed

5 files changed

+42
-54
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"@blueprintjs/core": "^5.17.5",
1616
"@blueprintjs/icons": "^5.19.1",
17-
"@emotion/react": "^11.14.0",
17+
"@emotion/styled": "^11.14.0",
1818
"fifo-logger": "^1.0.0",
1919
"filelist-utils": "^1.11.3",
2020
"nmr-load-save": "^3.1.2",

src/NMRiumWrapper.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ export default function NMRiumWrapper() {
115115

116116
return (
117117
<RootLayout style={styles.container}>
118-
{' '}
119118
{isFetchAllowedOriginsPending && (
120119
<div style={styles.loadingContainer}>
121120
<span>Loading .... </span>

src/demo/NMRiumWrapperDemo.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/** @jsxImportSource @emotion/react */
2-
import { css } from '@emotion/react';
1+
import styled from '@emotion/styled';
32
import type { NMRiumData } from 'nmrium';
43
import { Button } from 'react-science/ui';
54

@@ -9,24 +8,23 @@ import { loadFilesFromURLs } from '../utilities/loadFilesFromURLs';
98

109
import jsonData from './data/test.json';
1110

12-
const styles = {
13-
container: css`
14-
display: flex;
15-
flex-direction: column;
16-
height: 100%;
17-
`,
18-
header: css`
19-
height: 40px;
20-
width: 100%;
21-
padding: 5px;
22-
display: flex;
23-
`,
24-
};
11+
const Container = styled.div`
12+
display: flex;
13+
flex-direction: column;
14+
height: 100%;
15+
`;
16+
17+
const Header = styled.div`
18+
height: 40px;
19+
width: 100%;
20+
padding: 5px;
21+
display: flex;
22+
`;
2523

2624
export default function NMRiumWrapperDemo() {
2725
return (
28-
<div css={styles.container}>
29-
<div id="header" css={styles.header}>
26+
<Container>
27+
<Header>
3028
<Button
3129
style={{ marginRight: '10px' }}
3230
onClick={() => {
@@ -105,9 +103,9 @@ export default function NMRiumWrapperDemo() {
105103
>
106104
Test Logger
107105
</Button>
108-
</div>
106+
</Header>
109107

110108
<NMRiumWrapper />
111-
</div>
109+
</Container>
112110
);
113111
}

src/modal/AboutUsModal.tsx

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
/** @jsxImportSource @emotion/react */
21
import { Dialog, DialogBody } from '@blueprintjs/core';
3-
import { css } from '@emotion/react';
2+
import styled from '@emotion/styled';
43
import { useOnOff } from 'react-science/ui';
54

65
import versionInfo from '../versionInfo';
76

8-
const styles = css`
9-
button:focus {
10-
outline: none;
11-
}
12-
13-
.container {
14-
padding: 20px;
15-
display: flex;
16-
flex-direction: column;
17-
align-items: center;
18-
}
19-
20-
span.title {
21-
font-weight: bold;
22-
color: #ea580c;
23-
font-size: 1.5em;
24-
}
25-
26-
a {
27-
color: #969696;
28-
}
7+
const Title = styled.span`
8+
font-weight: bold;
9+
color: #ea580c;
10+
font-size: 1.5em;
11+
`;
12+
const Container = styled.div`
13+
padding: 20px;
14+
display: flex;
15+
flex-direction: column;
16+
align-items: center;
17+
`;
18+
const Link = styled.a`
19+
color: #969696;
2920
30-
a:hover,
31-
a:focus {
21+
&:hover,
22+
&:focus {
3223
color: #00bcd4;
3324
}
3425
`;
@@ -44,20 +35,20 @@ function AboutUsModal() {
4435
style={{ maxWidth: 1000 }}
4536
title="About NMRium react wrapper"
4637
>
47-
<DialogBody css={styles}>
48-
<div className="container">
49-
<span className="title"> NMRium react wrapper</span>
38+
<DialogBody>
39+
<Container>
40+
<Title> NMRium react wrapper</Title>
5041
<Separator />
5142
Version <VersionInfo />
5243
<Separator />
53-
<a
44+
<Link
5445
href="https://github.com/NFDI4Chem/nmrium-react-wrapper"
5546
target="_blank"
5647
rel="noreferrer"
5748
>
5849
GitHub ( https://github.com/NFDI4Chem/nmrium-react-wrapper )
59-
</a>
60-
</div>
50+
</Link>
51+
</Container>
6152
</DialogBody>
6253
</Dialog>
6354
</>
@@ -107,7 +98,7 @@ function InfoButton({ onClick }) {
10798
height: '25px',
10899
borderRadius: '25px',
109100
border: '0.55px solid #ea580c',
110-
left: '5px',
101+
left: '2px',
111102
bottom: '10px',
112103
position: 'absolute',
113104
}}

0 commit comments

Comments
 (0)