Skip to content

Commit fc93334

Browse files
authored
Remove dependency to styled-components (#109)
1 parent f3509cc commit fc93334

File tree

3 files changed

+2376
-330
lines changed

3 files changed

+2376
-330
lines changed

ReactPCDEditor/index.tsx

+49-42
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useEffect } from 'react'
2-
import styled from 'styled-components'
32

43
import PCDEditor from '../'
54

@@ -55,50 +54,58 @@ const Editor: React.FC<Props> = ({
5554
}, [wasmPath, wasmExecPath, appendDefaultMenu])
5655

5756
return (
58-
<Container>
59-
<canvas id={canvasId} tabIndex={0} />
60-
<div id={menuboxId} className="pcdeditorMenubox">
57+
<div
58+
style={{
59+
borderWidth: 0,
60+
width: '100%',
61+
height: '100%',
62+
position: 'relative',
63+
color: 'black',
64+
overflow: 'visible',
65+
}}
66+
>
67+
<canvas
68+
id={canvasId}
69+
tabIndex={0}
70+
style={{
71+
width: '100%',
72+
height: '100%',
73+
touchAction: 'none',
74+
}}
75+
/>
76+
<div
77+
id={menuboxId}
78+
className="pcdeditorMenubox"
79+
style={{
80+
display: 'flex',
81+
flexWrap: 'wrap',
82+
alignItems: 'stretch',
83+
position: 'absolute',
84+
top: 0,
85+
left: 0,
86+
padding: '2px',
87+
boxSizing: 'border-box',
88+
}}
89+
>
6190
{customMenu}
6291
</div>
63-
<div id={logId} className="pcdeditorLog" />
64-
</Container>
92+
<div
93+
id={logId}
94+
className="pcdeditorLog"
95+
style={{
96+
fontSize: '0.6em',
97+
maxHeight: '20em',
98+
position: 'absolute',
99+
bottom: '1em',
100+
left: '1em',
101+
zIndex: 2,
102+
color: 'white',
103+
pointerEvents: 'none',
104+
overflow: 'hidden',
105+
}}
106+
/>
107+
</div>
65108
)
66109
}
67110

68-
const Container = styled.div`
69-
border-width: 0;
70-
width: 100%;
71-
height: 100%;
72-
position: relative;
73-
color: black;
74-
overflow: visible;
75-
76-
canvas {
77-
width: 100%;
78-
height: 100%;
79-
touch-action: none;
80-
}
81-
div.pcdeditorMenubox {
82-
display: flex;
83-
flex-wrap: wrap;
84-
align-items: stretch;
85-
position: absolute;
86-
top: 0;
87-
left: 0;
88-
padding: 2px;
89-
box-sizing: border-box;
90-
}
91-
div.pcdeditorLog {
92-
font-size: 0.6em;
93-
max-height: 20em;
94-
position: absolute;
95-
bottom: 1em;
96-
left: 1em;
97-
z-index: 2;
98-
color: white;
99-
pointer-events: none;
100-
overflow: hidden;
101-
}
102-
`
103-
104111
export default Editor

0 commit comments

Comments
 (0)