Skip to content

Commit 5285671

Browse files
committed
Button and LinkButton components created
1 parent a2d1683 commit 5285671

4 files changed

Lines changed: 65 additions & 1 deletion

File tree

src/components/Banner/Banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function Banner() {
55
<div>
66
<div className="bg-white">
77
<div
8-
className="p-4"
8+
className="p-4 text-danger"
99
style={{
1010
background:
1111
'repeating-linear-gradient(-55deg, #222, rgb(34, 34, 34) 10px, rgb(234, 179, 8) 10px, rgb(234, 179, 8) 20px)',

src/components/Button/Button.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react';
2+
3+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4+
children: React.ReactNode;
5+
name: string;
6+
}
7+
8+
const Button: React.FC<ButtonProps> = ({ children, name, ...props }) => {
9+
return (
10+
<>
11+
<button
12+
type="button"
13+
name={name}
14+
{...props}
15+
className="p-4 px-8 text-white font-bold bg-red-600 rounded"
16+
style={{
17+
display: 'block',
18+
width: '200px',
19+
overflow: 'hidden',
20+
whiteSpace: 'nowrap',
21+
textOverflow: 'ellipsis',
22+
textAlign: 'center',
23+
}}
24+
>
25+
{children}
26+
</button>
27+
</>
28+
);
29+
};
30+
31+
export default Button;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
3+
interface LinkProps extends React.HTMLProps<HTMLAnchorElement> {
4+
children: React.ReactNode;
5+
to: string;
6+
}
7+
8+
const LinkButton: React.FC<LinkProps> = ({ to, children, ...props }) => {
9+
return (
10+
<>
11+
<a
12+
href={to}
13+
{...props}
14+
className="p-2"
15+
style={{
16+
width: '100px',
17+
overflow: 'hidden',
18+
whiteSpace: 'nowrap',
19+
textOverflow: 'ellipsis',
20+
textAlign: 'center',
21+
}}
22+
>
23+
{children}
24+
</a>
25+
</>
26+
);
27+
};
28+
29+
export default LinkButton;

src/pages/about/index.page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Head from 'next/head';
22
import React from 'react';
3+
import Button from '../../components/Button/Button';
4+
import LinkButton from '../../components/LinkButton/LinkButton';
35

46
export default function AboutPage() {
57
return (
@@ -9,6 +11,8 @@ export default function AboutPage() {
911
</Head>
1012
<main className="flex justify-center items-center min-h-screen">
1113
<h1 className="text-white">About page will be here</h1>
14+
<Button>Join Community</Button>
15+
<LinkButton to="https://test.com">test</LinkButton>
1216
</main>
1317
</>
1418
);

0 commit comments

Comments
 (0)