Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Add pagination component
Browse files Browse the repository at this point in the history
A component that uses the button atom and a <p> that accepts these props
- currentResults
- totalResults
  • Loading branch information
kasperbirch1 committed Jun 2, 2022
1 parent 923e885 commit 7a7f0f3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@import "./src/stories/counter/counter";
@import "./src/stories/checkbox/checkbox";
@import "./src/stories/availability-label/availability-label";
@import "./src/stories/search-result-pagination/search-result-pagination";

@import "./src/stories/list-reservation/list-reservation";
@import "./src/stories/list-dashboard/list-dashboard";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { withDesign } from "storybook-addon-designs";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { SearchResultPagination } from "./SearchResultPagination";

export default {
title: "Components / Search Result - Pagination",
component: SearchResultPagination,
decorators: [withDesign],
parameters: {
design: {
type: "figma",
url:
"https://www.figma.com/file/ETOZIfmgGS1HUfio57SOh7/S%C3%B8gning?node-id=1011%3A15112",
},
},
argTypes: {
currentResults: {
control: { type: "text" },
defaultValue: "10",
},
totalResults: {
control: { type: "text" },
defaultValue: "423",
},
},
} as ComponentMeta<typeof SearchResultPagination>;

const Template: ComponentStory<typeof SearchResultPagination> = (args) => {
return <SearchResultPagination {...args} />;
};

export const Item = Template.bind({});
Item.args = {};
30 changes: 30 additions & 0 deletions src/stories/search-result-pagination/SearchResultPagination.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Button } from "../button/Button";

interface SearchResultPaginationProps {
currentResults: string;
totalResults: string;
}

export const SearchResultPagination = ({
currentResults,
totalResults,
}: SearchResultPaginationProps) => {
return (
<div className="search-result-pagination">
<p className="text-small-caption search-result-pagination__title">
{`Viser ${currentResults} ud af ${totalResults} resultater`}
</p>
<Button
label={"VIS FLERE"}
disabled={false}
buttonType={"none"}
collapsible={false}
size={"medium"}
variant={"outline"}
onClick={() => {
console.log("onClick");
}}
/>
</div>
);
};
17 changes: 17 additions & 0 deletions src/stories/search-result-pagination/search-result-pagination.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.search-result-pagination {
&__title {
text-align: center;
margin-top: 24px;
margin-bottom: 16px;
}
}

// Override button css (Center + Width)
.search-result-pagination > .btn-primary {
margin: 0 auto;
width: 100%;

@include breakpoint-s {
max-width: 253px;
}
}

0 comments on commit 7a7f0f3

Please sign in to comment.