2021-02-09 09:33:54 +00:00
|
|
|
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<{
|
2021-02-09 09:33:54 +00:00
|
|
|
isClick: boolean;
|
|
|
|
size: number;
|
2021-01-24 20:54:14 +00:00
|
|
|
}>`
|
2021-02-09 09:33:54 +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 &&
|
2021-02-09 09:33:54 +00:00
|
|
|
`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}) {
|
2021-02-09 09:33:54 +00:00
|
|
|
return <HeartUI isClick={isClick} onClick={onClick} size={size} />;
|
|
|
|
}
|