Skip to content

Commit 4c487b8

Browse files
committed
improve background, border, and shadow rendering
1 parent 7850c1a commit 4c487b8

13 files changed

+446
-446
lines changed

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Better rounded corners
2+
23
*for HTML divs in React.js*
34

4-
`react-round-div` makes your rounded rectangles look smoother for a more pleasant feel. With a simple and easy integration into your code you have to do almost nothing to up the style of your project.
5+
`react-round-div` makes your rounded rectangles look smoother for a more pleasant feel. With a simple and easy
6+
integration into your code you have to do almost nothing to up the style of your project.
57

68
Here is a very clear demonstration of these smooth corners:
79

@@ -14,7 +16,10 @@ npm i react-round-div
1416
```
1517

1618
## Usage
17-
Simply import the package and replace any divs with rounded corners (`border-radius`) that you want to improve. `react-round-div` will handle the rest.
19+
20+
Simply import the package and replace any divs with rounded corners (`border-radius`) that you want to
21+
improve. `react-round-div` will handle the rest.
22+
1823
```jsx
1924
import RoundDiv from 'react-round-div';
2025

@@ -29,8 +34,33 @@ const App = () => {
2934
export default App;
3035
```
3136

37+
### Options
38+
39+
#### `dontConvertShadow`
40+
41+
If you have set a `box-shadow` in your CSS, `react-round-div` will convert it to
42+
a [`drop-shadow()`](https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/drop-shadow()). This happens
43+
because otherwise, the old rounded corners may shine through. If you want `react-round-div` to not convert
44+
your `box-shadow`s, add the `dontConvertShadow` option:
45+
46+
```jsx
47+
<RoundDiv dontConvertShadow>
48+
<p>Content</p>
49+
</RoundDiv>
50+
```
51+
52+
## Things to note & caveats
53+
54+
This package is still in the starting blocks, so for now borders are only supported in the `solid` style and transitions
55+
and animations on the div may not work properly.
56+
57+
There are a couple of css properties, that you can't reliably set with `RoundDiv`:
3258

33-
## Caveats
34-
This package is still in the starting blocks, so for now borders are only supported in the `solid` style and some transitions on the div may not work properly.
59+
- the `background` property and all the properties it is a shorthand for
60+
- `border-color`
61+
- `box-shadow`
62+
- `filter`, if you haven't set [`dontConvertShadow`](#dontconvertshadow)
3563

36-
Moreover, children inside `RoundDiv` get cut off when are placed (partly) outside the div due to `clip-path` being used to make the smooth corners. There will probably an option in later versions to use a pseudo-element for the shape, so that children can be rendered outside.
64+
You shouldn't set these properties inline. Instead, set them in a stylesheet. This may change in future versions.
65+
The `filter` property in particular will not work at all, if you have set a `box-shadow` AND have not
66+
set [`dontConvertShadow`](#dontconvertshadow). This may also change in future versions.

package-lock.json

Lines changed: 119 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-round-div",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Make your rounded corners look phenomenal with g2 continuity.",
55
"main": "dist/main.js",
66
"scripts": {
@@ -23,7 +23,11 @@
2323
},
2424
"homepage": "https://github.com/drinking-code/react-round-div#readme",
2525
"dependencies": {
26-
"prop-types": "^15.7.2",
26+
"css": "^3.0.0",
27+
"react-shadow-root": "^6.1.1",
28+
"specificity": "^0.4.1"
29+
},
30+
"peerDependencies": {
2731
"react": "^17.0.2",
2832
"react-dom": "^17.0.2"
2933
},

src/external/apearce:react-shadow-dom.js

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/external/getMatchedCSSRules-polyfill.js

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)