Skip to content

Commit 949b969

Browse files
add support for elliptical radius on ellipse border radius
1 parent 2f3c300 commit 949b969

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

  • packages

packages/builder-css-styles/border-radius/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ export function borderRadius(r: BorderRadiusManifest): CSSProperties {
6060
"border-radius": px(r.all),
6161
};
6262
} else {
63-
console.warn("elliptical border radius not supported");
63+
// example - https://codepen.io/Mahe76/pen/ExZbdro
6464
return {
65-
"border-radius": px(r.all.x),
65+
"border-radius": `${px(r.all.x)} / ${px(r.all.y)}`,
6666
};
67+
// TODO: support short handed version - `50%`
6768
}
6869
} else {
6970
return {

packages/designto-token/token-container/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { tokenizeBackground } from "../token-background";
44
import { BoxShape } from "@reflect-ui/core/lib/box-shape";
55
import { keyFromNode } from "../key";
66
import { tokenizeBorder } from "../token-border";
7-
import { BoxShadowManifest } from "@reflect-ui/core";
7+
import { BorderRadius, BoxShadowManifest } from "@reflect-ui/core";
88

99
function fromRectangle(rect: nodes.ReflectRectangleNode): core.Container {
1010
const container = new core.Container({
@@ -30,7 +30,7 @@ function fromEllipse(ellipse: nodes.ReflectEllipseNode): core.Container {
3030
height: ellipse.height,
3131
boxShadow: ellipse.shadows as BoxShadowManifest[],
3232
border: tokenizeBorder.fromNode(ellipse),
33-
borderRadius: { all: Math.max(ellipse.width, ellipse.height) / 2 },
33+
borderRadius: BorderRadius.all({ x: ellipse.width, y: ellipse.height }), // this is equivalant to css "50%"
3434
background: tokenizeBackground.fromFills(ellipse.fills),
3535
});
3636

0 commit comments

Comments
 (0)