mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-02 02:10:27 +00:00
Add width and height as props for icon button component
This commit is contained in:
@@ -3,21 +3,29 @@ import styled from 'styled-components';
|
||||
import Image from 'next/image';
|
||||
interface Props {
|
||||
icon: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const Btn = styled.button`
|
||||
display: inline;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
color: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const IconButton: FC<Props & { className?: string }> = ({ icon, onClick, className }) => {
|
||||
const IconButton: FC<Props & { className?: string }> = ({
|
||||
icon,
|
||||
onClick,
|
||||
className,
|
||||
width = 24,
|
||||
height = 24
|
||||
}) => {
|
||||
return (
|
||||
<Btn onClick={onClick} className={className}>
|
||||
<Image src={icon} width={24} height={24} />
|
||||
<Image src={icon} width={width} height={height} />
|
||||
</Btn>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user