Skip to content

Commit

Permalink
Merge pull request #31 from Bear29ers/feature/#27_create_footer_compo…
Browse files Browse the repository at this point in the history
…nent

Feature/#27 Create footer component(Footerコンポーネントを作成する)
  • Loading branch information
Bear29ers committed Jul 17, 2023
2 parents 51cedd5 + a295811 commit d8a8dcf
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/Footer/Footer.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Footer from './Footer';

import type { Meta, StoryObj } from '@storybook/react';

const meta: Meta<typeof Footer> = {
component: Footer,
};

export default meta;

type Story = StoryObj<typeof Footer>;

export const Standard: Story = {
render: () => <Footer />,
};
15 changes: 15 additions & 0 deletions src/components/Footer/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { render } from '@testing-library/react';

import Footer from './Footer';

describe('src/components/Footer/Footer.test.tsx', () => {
it('should render Footer component', () => {
const { getByRole } = render(<Footer />);
expect(getByRole('contentinfo')).toBeInTheDocument();
});

it('should render Footer component with two span tags', () => {
const { container } = render(<Footer />);
expect(container.querySelectorAll('span')).toHaveLength(2);
});
});
18 changes: 18 additions & 0 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { FC } from 'react';

const Footer: FC = () => {
return (
<footer className="w-full text-sm" role="contentinfo">
<div className="flex-between px-32 pb-2">
<span>{new Date().getFullYear()} &copy; All Rights Reserved.</span>
<div className="flex items-center">
Build With&nbsp;
<span className="px-1 text-2xl text-primary">&#9825;</span>
&nbsp;by&nbsp;Bear29ers
</div>
</div>
</footer>
);
};

export default Footer;
18 changes: 18 additions & 0 deletions src/components/PageLayout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,22 @@ describe('src/components/PageLayout/PageLayout.test.tsx', () => {
);
expect(getByRole('presentation')).toBeInTheDocument();
});

it('should render PageLayout component with Navbar', () => {
const { getByRole } = render(
<PageLayout>
<div>PageLayout</div>
</PageLayout>
);
expect(getByRole('banner')).toBeInTheDocument();
});

it('should render PageLayout component with Footer', () => {
const { getByRole } = render(
<PageLayout>
<div>PageLayout</div>
</PageLayout>
);
expect(getByRole('contentinfo')).toBeInTheDocument();
});
});
2 changes: 2 additions & 0 deletions src/components/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { FC, ReactNode } from 'react';

import Footer from '../Footer/Footer';
import Navbar from '../Navbar/Navbar';

type Props = {
Expand All @@ -11,6 +12,7 @@ const PageLayout: FC<Props> = ({ children }) => {
<div role="presentation">
<Navbar />
{children}
<Footer />
</div>
);
};
Expand Down

0 comments on commit d8a8dcf

Please sign in to comment.