Skip to content

Commit

Permalink
feat: create RowButtonBlock components
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed May 6, 2024
1 parent fa335dc commit a7ae98d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions components/atoms/blocks/RowButtonBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import Link, { LinkProps } from "next/link";
import styled from "styled-components";

interface RowButtonBlockProps {
Expand All @@ -8,7 +8,9 @@ interface RowButtonBlockProps {
}

function RowButtonBlock({ text, url, func }: RowButtonBlockProps) {
return <Button onClick={func}>{url ? <Link href={url}>{text}</Link> : text}</Button>;
return (
<>{url ? <CustomLink href={url}>{text}</CustomLink> : <Button onClick={func}>{text}</Button>}</>
);
}

const Button = styled.button`
Expand All @@ -18,4 +20,11 @@ const Button = styled.button`
border-bottom: var(--border);
`;

const CustomLink = styled(Link)<LinkProps>`
display: block;
padding: var(--gap-4) var(--gap-4);
text-align: start;
border-bottom: var(--border);
`;

export default RowButtonBlock;

0 comments on commit a7ae98d

Please sign in to comment.