Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User registration form v2 #616

Merged
merged 12 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
@import "./src/stories/Blocks/loan-page/loan-page-skeleton";
@import "./src/stories/Blocks/registration-page/registration-page";
@import "./src/stories/Blocks/form/form";
@import "./src/stories/Blocks/create-patron/create-patron";

@import "./src/styles/scss/shared";
@import "./src/styles/scss/internal";
Expand Down
28 changes: 28 additions & 0 deletions src/stories/Blocks/create-patron/CreatePatron.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ComponentStory } from "@storybook/react";
import { withDesign } from "storybook-addon-designs";
import CreatePatron, { CreatePatronProps } from "./CreatePatron";

export default {
title: "Blocks / Create Patron",
component: CreatePatron,
decorators: [withDesign],
argTypes: {
headline: {
name: "Title",
defaultValue: "Register as patron",
control: { type: "text" },
},
},
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=14631%3A36424&mode=design&t=kNDJGSba8OVIdnRx-1",
},
},
};

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

export const Default = Template.bind({});
52 changes: 52 additions & 0 deletions src/stories/Blocks/create-patron/CreatePatron.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Button } from "../../Library/Buttons/button/Button";
import DoubleInputRow from "../../Library/Forms/input/DoubleInputRow";
import { Dropdown } from "../../Library/dropdown/Dropdown";
import { Links } from "../../Library/links/Links";

export interface CreatePatronProps {
headline: string;
}

const CreatePatron: React.FC<CreatePatronProps> = ({ headline }) => {
return (
<div className="create-patron-page">
<h1 className="create-patron-page__title">{headline}</h1>
<form>
<section className="create-patron-page__row">
<DoubleInputRow leftLabel="Phone number*" rightLabel="Email*" />
</section>
<section className="create-patron-page__row">
<DoubleInputRow leftLabel="New pin*" rightLabel="Confirm new pin*" />
</section>
<Dropdown
ariaLabel="Choose pickup branch"
arrowIcon="chevron"
list={[
{ title: "Nothing selected" },
{ title: "Option 1" },
{ title: "Option 2" },
]}
classNames="dropdown--grey-borders"
labelComponent={
<label className="text-body-medium-medium mb-8">
Choose pickup branch*
</label>
}
footnote="Choose preferred library for pickup of your future reservations."
/>
<div className="create-patron-page__buttons">
<Button
buttonType="none"
label="Create profile"
size="small"
variant="filled"
classNames="mr-16"
/>
<Links href="#" linkText="Cancel" classNames="mt-8" />
</div>
</form>
</div>
);
};

export default CreatePatron;
29 changes: 29 additions & 0 deletions src/stories/Blocks/create-patron/create-patron.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.create-patron-page {
background: $color__global-primary;
padding: $s-2xl $s-sm $s-6xl $s-sm;

@include media-query__small {
margin: auto;
max-width: 550px;
padding: $s-5xl 0 $s-2xl 0;
}

&__title {
@include typography($typo__h1);
margin-bottom: $s-2xl;

@include media-query__small {
margin-bottom: $s-5xl;
}
}

&__row {
@include media-query__small {
margin-bottom: $s-3xl;
}
}

&__buttons {
display: flex;
}
}
30 changes: 30 additions & 0 deletions src/stories/Library/Forms/input/DoubleInputRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Input from "./Input";

export type DoubleInputRowProps = {
leftLabel: string;
rightLabel: string;
};

const DoubleInputRow: React.FC<DoubleInputRowProps> = ({
Adamik10 marked this conversation as resolved.
Show resolved Hide resolved
leftLabel,
rightLabel,
}) => {
return (
<div className="contact-info-flex">
Adamik10 marked this conversation as resolved.
Show resolved Hide resolved
<Input
id={leftLabel}
label={leftLabel}
type="text"
classNames="patron__input patron__input--desktop mr-16"
/>
<Input
id={rightLabel}
label={rightLabel}
type="text"
classNames="patron__input patron__input--desktop"
Adamik10 marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
);
};

export default DoubleInputRow;
6 changes: 4 additions & 2 deletions src/stories/Library/Forms/input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import clsx from "clsx";
import Label from "../label/Label";

export type InputProps = {
Expand All @@ -6,13 +7,14 @@ export type InputProps = {
id: string;
description?: string;
validation?: string;
classNames?: string;
};

const Input = (props: InputProps) => {
const { label, type, id, description, validation } = props;
const { label, type, id, description, validation, classNames } = props;
const invalid = validation ? "true" : "false";
return (
<div className="dpl-input">
<div className={clsx("dpl-input", !!classNames && classNames)}>
Adamik10 marked this conversation as resolved.
Show resolved Hide resolved
<Label id={id}>{label}</Label>
<input
aria-invalid={invalid}
Expand Down
7 changes: 7 additions & 0 deletions src/stories/Library/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type DropdownElementProps = {
arrowIcon: "triangles" | "chevron";
classNames?: string;
innerClassNames?: { select?: string; option?: string; arrowWrapper?: string };
footnote?: string;
};

const DropdownElement: React.FC<DropdownElementProps> = ({
Expand All @@ -25,6 +26,7 @@ const DropdownElement: React.FC<DropdownElementProps> = ({
list,
classNames,
innerClassNames,
footnote,
}) => {
const Icon = () => {
if (arrowIcon === "triangles") {
Expand Down Expand Up @@ -70,6 +72,7 @@ const DropdownElement: React.FC<DropdownElementProps> = ({
<Icon />
</div>
</div>
{footnote && <div className="dropdown__footnote">{footnote}</div>}
</>
);
};
Expand All @@ -82,6 +85,7 @@ export type DropdownProps = {
classNames?: string;
innerClassNames?: { select?: string; option?: string; arrowWrapper?: string };
hideInputWrapper?: boolean;
footnote?: string;
};

export const Dropdown: React.FC<DropdownProps> = ({
Expand All @@ -92,6 +96,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
classNames,
innerClassNames,
hideInputWrapper = false,
footnote,
}) => {
if (hideInputWrapper) {
return (
Expand All @@ -102,6 +107,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
list={list}
classNames={classNames}
innerClassNames={innerClassNames}
footnote={footnote}
/>
);
}
Expand All @@ -115,6 +121,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
list={list}
classNames={classNames}
innerClassNames={innerClassNames}
footnote={footnote}
/>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/stories/Library/dropdown/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ $_dropdown-icon-size: 50px;
.dropdown__arrows--inline {
height: 100%;
}

.dropdown__footnote {
@include typography($typo__small-caption);
margin: $s-sm 0 $s-3xl 0;
}
2 changes: 2 additions & 0 deletions src/stories/Library/patron-info/patron-info.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
display: flex;
flex-direction: column;
@include typography($typo__body-medium);
margin-bottom: $s-xl;

label {
@include typography($typo__body-medium);
Expand Down Expand Up @@ -76,6 +77,7 @@
}

input[type="number"] {
appearance: textfield;
-moz-appearance: textfield;
}
}
Expand Down
Loading