Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";
import { items } from "./uneditable-section-shared";

export default function Story() {
return (
<div className="story-column-container story-background">
<UneditableSection
data-testid="uneditable-section-full-width"
title="Personal Information"
description="Sample description"
items={items}
fullWidth
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";
import { items } from "./uneditable-section-shared";

export default function Story() {
return (
<div className="story-column-container story-background">
<UneditableSection
data-testid="uneditable-section"
title="Personal Information"
description="Sample description"
items={items}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";
import { items } from "./uneditable-section-shared";

export default function Story() {
return (
<div className="story-column-container story-background">
<UneditableSection
data-testid="uneditable-section"
title="Personal Information"
description="Sample description"
items={items}
background={false}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";

export default function Story() {
return (
<UneditableSection
data-testid="uneditable-section"
title="Personal Information"
items={[
{
label: "Error and alert variant",
value: "S1234534J",
maskState: "masked",
maskRange: [1, 4],
maskLoadingState: "fail",
displayWidth: "half",
alert: {
children: "Sample alert message",
type: "warning",
},
},
]}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"use client";

import { Alert } from "@lifesg/react-design-system/alert";
import { Button } from "@lifesg/react-design-system/button";
import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";
import styles from "./full-custom-sections.module.css";

export default function Story() {
return (
<UneditableSection>
<div className={styles["custom-style-1"]}>
<div className={styles["custom-style-2"]}>
<h3>My custom content</h3>
<Button styleType="light">Custom button</Button>
</div>
<div className={styles["custom-style-3"]}>
<Alert type="warning">Custom alert</Alert>
</div>
<p className={styles["custom-style-3"]}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Etiam pellentesque enim eu neque gravida, ut pulvinar magna
tristique. Aenean sed malesuada arcu. Integer convallis
dapibus suscipit.
</p>
<UneditableSection.ItemSection>
<UneditableSection.Item
displayWidth="half"
label="Name (as in NRIC or passport)"
value="Tom Tan Li Ho"
/>
<UneditableSection.Item
displayWidth="half"
label="NRIC or FIN"
value="S••••534J"
/>
<UneditableSection.Item
label="Residential Address"
value="Block 287, #05-11, Tampines street 22, Singapore 534788"
/>
</UneditableSection.ItemSection>
<h3 className={styles["custom-style-2"]}>Another section</h3>
<UneditableSection.ItemSection>
<UneditableSection.Item
label="Custom content list"
value={
<ul>
<li>Option 1</li>
<li>Option 2</li>
<li>Option 3</li>
</ul>
}
/>
</UneditableSection.ItemSection>
</div>
</UneditableSection>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.custom-style-1 {
display: flex;
flex-direction: column;
grid-column: span 8;
}

.custom-style-2 {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 2rem;
}

.custom-style-3 {
margin-bottom: 1rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";

export default function Story() {
return (
<UneditableSection
data-testid="uneditable-section"
title="Personal Information"
items={[
{
label: "Loading variant",
value: "S1234534J",
maskState: "masked",
maskRange: [1, 4],
maskLoadingState: "loading",
displayWidth: "half",
},
]}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";

export default function Story() {
return (
<div className="story-column-container story-background">
<UneditableSection
data-testid="uneditable-section-full-width"
title="Personal Information"
description="Sample description"
items={[
{
displayWidth: "half",
label: "Plain text",
value: "S1234567D",
},
{
displayWidth: "half",
label: "With mask range",
maskRange: [1, 4],
maskState: "masked",
value: "S1234567D",
},
{
displayWidth: "half",
label: "With mask range (start only)",
maskRange: [4, 9999],
maskState: "masked",
value: "S1234567D",
},
{
displayWidth: "half",
label: "With mask range (end only)",
maskRange: [0, 4],
maskState: "masked",
value: "S1234567D",
},
{
displayWidth: "half",
label: "With unmask range",
maskState: "masked",
unmaskRange: [1, 4],
value: "S1234567D",
},
{
displayWidth: "half",
label: "With mask regex",
maskRegex: /\D/g,
maskState: "masked",
value: "S1234567D",
},
{
displayWidth: "half",
label: "With mask transformer (X)",
maskState: "masked",
maskTransformer: (value) => value.replace(/\d/g, "X"),
value: "S1234567D",
},
{
disableMaskUnmask: true,
displayWidth: "half",
label: "With mask range but disabled unmasking",
maskRange: [1, 4],
maskState: "masked",
value: "S1234567D",
},
]}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"use client";

import { UneditableSection } from "@lifesg/react-design-system/uneditable-section";
import { Alert } from "@lifesg/react-design-system/alert";
import { Button } from "@lifesg/react-design-system/button";

export default function Story() {
return (
<UneditableSection
data-testid="uneditable-section"
title="Personal Information"
description="Your personal details with additional sections"
topSection={
<Alert type="info" data-testid="top-section-alert">
Custom alert section
</Alert>
}
items={[
{
label: "Name (as in NRIC or passport)",
value: "Tom Tan Li Ho",
displayWidth: "half",
},
{
label: "NRIC or FIN",
value: "S1234534J",
displayWidth: "half",
},
{
label: "Date of birth",
value: "6 November 1992",
displayWidth: "half",
},
{
label: "Nationality",
value: "Singaporean",
displayWidth: "half",
},
]}
bottomSection={
<div data-testid="bottom-section-actions">
<Button>Custom button</Button>
</div>
}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { UneditableSectionItemProps } from "@lifesg/react-design-system/uneditable-section";

export const items: UneditableSectionItemProps[] = [
{
displayWidth: "half",
label: "Name (as in NRIC or passport)",
value: "Tom Tan Li Ho",
},
{
displayWidth: "half",
label: "NRIC or FIN",
maskRange: [1, 4],
maskState: "masked",
value: "S1234534J",
},
{
displayWidth: "half",
label: "Date of birth",
value: "6 November 1992",
},
{
displayWidth: "half",
label: "Residential Address",
value: "Block 287, #05-11, Tampines Street 22, Singapore 534788",
},
{
label: "Ethnicity",
value: "Chinese",
},
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a border to indicate the custom sections

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is meant to be deleted and we're using the Partial-custom one

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we include a mobile screenshot of this?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this doesn't look right, it's supposed to switch to 1 column view on mobile

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets not include loading into the cases as the animation makes it unstable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can still include loading, should be alright since this is a css animation, and playwright pauses it accordingly. but the timer manipulation needs to be consistent. link-list did something similar, can reference that

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehhhh we don't probably don't need ALL masked variants since a lot of this is programmatic, and doesn't have a visual difference

just check if they are covered in the unit tests, if not, add the scenarios there. remove from the e2e test

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading