Skip to content

Commit 2998fc7

Browse files
committed
slight improvements and bugfixes
1 parent 8ef317c commit 2998fc7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ npm i react-round-div
2828

2929
| | Gzipped | Minified + Gzipped |
3030
|----------------------------------|---------:|-------------------:|
31-
| `react-round-div` | 7.8 KB | 5.28 KB |
32-
| `react-round-div` + dependencies | 14.97 KB | **9.17 KB** |
31+
| `react-round-div` | 7.71 KB | 5.18 KB |
32+
| `react-round-div` + dependencies | 14.88 KB | **9.07 KB** |
3333

3434
## Usage
3535

src/main.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
116116
}
117117

118118
const shapeComponentStyles = {
119-
// height: boxSizing === 'border-box' ? height : height - (border.width[0] + padding[0] + border.width[2] + padding[2]),
120-
// width: boxSizing === 'border-box' ? width : width - (border.width[1] + padding[1] + border.width[3] + padding[3]),
121-
height,
122-
width,
119+
height: boxSizing === 'border-box' ? height : height - (border.width[0] + padding[0] + border.width[2] + padding[2]),
120+
width: boxSizing === 'border-box' ? width : width - (border.width[1] + padding[1] + border.width[3] + padding[3]),
123121
padding: padding.map(n => n + 'px').join(' '),
124122
position: 'fixed',
125123
left: 0,
@@ -141,7 +139,7 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
141139
clipPath: `path("${path}")`,
142140
// inset shadow only
143141
boxShadow: shadows[1].join(','),
144-
borderRadius: radius.map(n => (n - 1) + 'px').join(' '),
142+
borderRadius: radius.map(n => (n * .95) + 'px').join(' '),
145143
...(Object.fromEntries(Object.keys(background).map(key => {
146144
return [camelise(key === 'null' ? 'background' : ('background-' + key)), background[key]]
147145
}))),
@@ -153,12 +151,11 @@ export default function RoundDiv({style, children, dontConvertShadow, ...props})
153151
clipPath: `path("${path}")`
154152
}}>
155153
<div style={{
156-
height,
157-
width,
158-
// boxSizing: 'border-box',
154+
height: height - (widenedBorderWidth[0] + widenedBorderWidth[2]),
155+
width: width - (widenedBorderWidth[1] + widenedBorderWidth[3]),
159156
transform: `translate(-${border.width[3]}px, -${border.width[0]}px)`,
160157
clipPath: `path("M0,0V${height}H${width}V0Z${innerPath}")`,
161-
borderRadius: radius.map(n => (n - 1) + 'px').join(' '),
158+
borderRadius: radius.map(n => (n * .95) + 'px').join(' '),
162159
borderColor: border.color,
163160
borderWidth: widenedBorderWidth.map(v => v + 'px').join(' '),
164161
borderStyle: border.style,

0 commit comments

Comments
 (0)