feat: fixes and formatter
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import React from 'react'
|
||||
|
||||
import "./rotationTestStyle.css";
|
||||
import './rotationTestStyle.css'
|
||||
|
||||
// Web-only rotating gradient border container
|
||||
// Props:
|
||||
@@ -16,44 +16,44 @@ const RotationBorder = ({
|
||||
style,
|
||||
className,
|
||||
active = true,
|
||||
colors = ["#F94697", "#7023F7"],
|
||||
colors = ['#F94697', '#7023F7'],
|
||||
duration = 5,
|
||||
borderWidth = 1,
|
||||
borderRadius,
|
||||
fillColor = "transparent",
|
||||
fillColor = 'transparent',
|
||||
}) => {
|
||||
const classes = [
|
||||
"rotation-border",
|
||||
active ? "rotation-border--active" : "rotation-border--static",
|
||||
'rotation-border',
|
||||
active ? 'rotation-border--active' : 'rotation-border--static',
|
||||
className,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
.join(' ')
|
||||
|
||||
const inlineStyle = { ...style };
|
||||
const inlineStyle = { ...style }
|
||||
|
||||
inlineStyle["--rotation-border-width"] = `${borderWidth}px`;
|
||||
inlineStyle["--rotation-border-color-1"] = colors[0];
|
||||
inlineStyle["--rotation-border-color-2"] = colors[1] ?? colors[0];
|
||||
inlineStyle["--rotation-border-duration"] = `${duration}s`;
|
||||
inlineStyle["--rotation-border-fill"] = fillColor;
|
||||
inlineStyle['--rotation-border-width'] = `${borderWidth}px`
|
||||
inlineStyle['--rotation-border-color-1'] = colors[0]
|
||||
inlineStyle['--rotation-border-color-2'] = colors[1] ?? colors[0]
|
||||
inlineStyle['--rotation-border-duration'] = `${duration}s`
|
||||
inlineStyle['--rotation-border-fill'] = fillColor
|
||||
|
||||
if (typeof borderRadius !== "undefined") {
|
||||
inlineStyle.borderRadius = borderRadius;
|
||||
if (typeof borderRadius !== 'undefined') {
|
||||
inlineStyle.borderRadius = borderRadius
|
||||
}
|
||||
|
||||
if (typeof inlineStyle.borderRadius !== "undefined") {
|
||||
inlineStyle["--rotation-border-radius"] =
|
||||
typeof inlineStyle.borderRadius === "number"
|
||||
if (typeof inlineStyle.borderRadius !== 'undefined') {
|
||||
inlineStyle['--rotation-border-radius'] =
|
||||
typeof inlineStyle.borderRadius === 'number'
|
||||
? `${inlineStyle.borderRadius}px`
|
||||
: inlineStyle.borderRadius;
|
||||
: inlineStyle.borderRadius
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classes} style={inlineStyle}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default RotationBorder;
|
||||
export default RotationBorder
|
||||
|
||||
Reference in New Issue
Block a user