ente/src/components/FavButton.tsx

24 lines
643 B
TypeScript
Raw Normal View History

import React from 'react';
import styled from 'styled-components';
2021-01-15 11:11:24 +00:00
2021-01-24 20:54:14 +00:00
const HeartUI = styled.button<{
isClick: boolean;
size: number;
2021-01-24 20:54:14 +00:00
}>`
width: ${(props) => props.size}px;
height: ${(props) => props.size}px;
float: right;
background: url('/fav-button.png') no-repeat;
cursor: pointer;
background-size: cover;
border: none;
2021-05-29 06:27:52 +00:00
${({isClick, size}) => isClick &&
`background-position: -${
28 * size
}px;transition: background 1s steps(28);`}
2021-01-15 11:11:24 +00:00
`;
2021-05-29 06:27:52 +00:00
export default function FavButton({isClick, onClick, size}) {
return <HeartUI isClick={isClick} onClick={onClick} size={size} />;
}