ente/src/components/FavButton.tsx

25 lines
655 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-08-13 02:38:38 +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-30 16:56:48 +00:00
export default function FavButton({ isClick, onClick, size }) {
return <HeartUI isClick={isClick} onClick={onClick} size={size} />;
}