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