diff --git a/base.scss b/base.scss index d3e089090..24677307e 100644 --- a/base.scss +++ b/base.scss @@ -93,6 +93,8 @@ @import "./src/stories/Library/Lists/fee-list/fee-list"; @import "./src/stories/Library/instant-loan/instant-loan"; @import "./src/stories/Library/scroll-lock-background/scroll-lock-background"; +@import "./src/stories/Library/multiselect/multiselect"; +@import "./src/stories/Library/input-with-dropdown/input-with-dropdown"; // Autosuggest block styling needs to be loaded before the rest of the scss for autosuggest @import "./src/stories/Blocks/autosuggest/autosuggest"; @@ -106,6 +108,7 @@ @import "./src/stories/Blocks/status-loans/status-loans"; @import "./src/stories/Blocks/status-userprofile/status-userprofile"; @import "./src/stories/Blocks/material-manifestation-item/material-manifestation-item"; +@import "./src/stories/Blocks/advanced-search/advanced-search"; @import "./src/styles/scss/shared"; @import "./src/styles/scss/internal"; diff --git a/public/icons/collection/MinusButton.svg b/public/icons/collection/MinusButton.svg new file mode 100644 index 000000000..0162c0dee --- /dev/null +++ b/public/icons/collection/MinusButton.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/icons/collection/PlusButton.svg b/public/icons/collection/PlusButton.svg new file mode 100644 index 000000000..f15c46907 --- /dev/null +++ b/public/icons/collection/PlusButton.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/stories/Blocks/advanced-search/AdvancedSearch.stories.tsx b/src/stories/Blocks/advanced-search/AdvancedSearch.stories.tsx new file mode 100644 index 000000000..f4f6a6572 --- /dev/null +++ b/src/stories/Blocks/advanced-search/AdvancedSearch.stories.tsx @@ -0,0 +1,52 @@ +import { ComponentStory } from "@storybook/react"; +import { withDesign } from "storybook-addon-designs"; +import { + AdvancedSearch as AdvancedSearchComp, + AdvancedSearchProps, +} from "./AdvancedSearch"; + +export default { + title: "Blocks / Advanced Search", + component: AdvancedSearchComp, + decorators: [withDesign], + argTypes: { + inputPlaceholder: { + name: "Input placeholder", + defaultValue: "Søgeterm", + control: { type: "text" }, + }, + inputAmount: { + name: "Amount of input rows", + defaultValue: 2, + control: { type: "number" }, + }, + cqlPreviewText: { + name: "CQL preview text", + defaultValue: + "title = harry potter AND subtitle = and the philosophers stone", + control: { type: "text" }, + }, + isCqlSearch: { + name: "Is CQL search?", + defaultValue: false, + control: { type: "boolean" }, + }, + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=9759%3A31313&mode=design&t=G77riF8Vp9iyZ7pP-1", + }, + }, +}; + +const Template: ComponentStory = ( + args: AdvancedSearchProps +) => ; + +export const AdvancedSearch = Template.bind({}); + +export const CqlSearch = Template.bind({}); +CqlSearch.args = { + isCqlSearch: true, +}; diff --git a/src/stories/Blocks/advanced-search/AdvancedSearch.tsx b/src/stories/Blocks/advanced-search/AdvancedSearch.tsx new file mode 100644 index 000000000..408760037 --- /dev/null +++ b/src/stories/Blocks/advanced-search/AdvancedSearch.tsx @@ -0,0 +1,126 @@ +import React from "react"; +import { InputWithDropdown } from "../../Library/input-with-dropdown/InputWithDropdown"; +import { Multiselect } from "../../Library/multiselect/Multiselect"; +import { Button } from "../../Library/Buttons/button/Button"; +import InputPreview from "../../Library/input-preview/InputPreview"; +import data from "../../Library/card-list-page/CardListPageData"; +import { CardListItem } from "../../Library/card-list-item/CardListItem"; +import ResultPager from "../../Library/card-list-page/ResultPager"; + +export interface AdvancedSearchProps { + inputPlaceholder: string; + inputAmount: number; + cqlPreviewText: string; + isCqlSearch: boolean; +} + +export const AdvancedSearch: React.FC = ({ + inputPlaceholder, + inputAmount, + cqlPreviewText, + isCqlSearch, +}) => { + return ( +
+

+ {isCqlSearch ? "CQL søgning" : "Avanceret søgning"} +

+ {!isCqlSearch && ( + <> +
+
+ + {Array(inputAmount - 1) + .fill(0) + .map(() => { + return ( + <> +
+ + + +
+ + + ); + })} + +
+ +
+
+ {Array(3) + .fill(0) + .map((item, index) => { + return ( +
+ +
+ ); + })} +
+ + + )} + {isCqlSearch && ( +