.image__frame {
filter: url('#border-radius');
width: 95%;
height: 100%;
position: absolute;
z-index: -1;
top: -5%;
left: 5%;
&::before {
content: "";
display: block;
padding-top: 55%;
background: #991E66;
clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
}
}
<div className={style.image__frame}></div>
<svg
style={{ visibility: 'hidden', position: 'absolute' }}
width="0"
height="0"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
>
<defs>
<filter id="border-radius">
<feGaussianBlur
in="SourceGraphic"
stdDeviation="15"
result="blur"
/>
<feColorMatrix
in="blur"
mode="matrix"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 35 -9"
result="border-radius"
/>
<feComposite
in="SourceGraphic"
in2="border-radius"
operator="atop"
/>
</filter>
</defs>
</svg>
.testClass {
font-size: 1.5em;
text-align: center;
color: #bf4f74;
}
.testClass::before {
content: 'QQ';
position: absolute;
top: 10px;
}
// ...
const [textColour, setTextColour] = useState('blue');
const TestElement = styled.h1`
&:before {
color: ${textColour}
}
`;
return (
<>
<button
onClick={() =>
setTextColour((color) => (color === 'black' ? 'red' : 'black'))
}
>
Change color of :before
</button>
<Title TestElement="testClass"> HELLO </Title>
</>
);