Я не думаю, что возможно заполнить сердце снизу вверх так, как вы хотите, если оно создано с использованием псевдоэлементов.
Это возможно с SVG с clipPath
, хотя - что-то вроде этого:
const ProgressBar = props => {
const y = 24 - (24 * props.percentage) / 100;
return (
<div className="ProgressBarH">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
>
<defs>
<clipPath id="cut-off-bottom">
<rect x="0" y={y} width="24" height="24" />
</clipPath>
</defs>
<path
style={{ fill: "red" }}
d="M12 4.248c-3.148-5.402-12-3.825-12 2.944 0 4.661 5.571 9.427 12 15.808 6.43-6.381 12-11.147 12-15.808 0-6.792-8.875-8.306-12-2.944z"
clipPath="url(#cut-off-bottom)"
/>
</svg>
</div>
);
};
Быстрая и грязная песочница здесь: https://codesandbox.io/s/optimistic-bird-8g63q
Отредактировано, чтобы добавить черную рамку:
<svg
xmlns="http://www.w3.org/2000/svg"
width="26"
height="26"
viewBox="0 0 26 26"
>
<defs>
<clipPath id="cut-off-bottom">
<rect x="0" y={y} width="26" height="24" />
</clipPath>
</defs>
<path
style={{ fill: "red" }}
d="M12 4.248c-3.148-5.402-12-3.825-12 2.944 0 4.661 5.571 9.427 12 15.808 6.43-6.381 12-11.147 12-15.808 0-6.792-8.875-8.306-12-2.944z"
clipPath="url(#cut-off-bottom)"
/>
<path
style={{ stroke: "black", strokeWidth: "2", fill: "none" }}
d="M12 4.248c-3.148-5.402-12-3.825-12 2.944 0 4.661 5.571 9.427 12 15.808 6.43-6.381 12-11.147 12-15.808 0-6.792-8.875-8.306-12-2.944z"
/>
</svg>
(см. песочница )