WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
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
91 changes: 91 additions & 0 deletions pages/visual-contexts/flashbar.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import React, { useState } from 'react';

import { Box, Button, Flashbar, KeyValuePairs, Link, Modal, Popover, ProgressBar, SpaceBetween } from '~components';

import { SimplePage } from '../app/templates';

export default function () {
const components = [
{ key: 'detail-v1', content: <DetailV1 /> },
{ key: 'detail-v2', content: <DetailV2 /> },
{
key: 'popover',
content: (
<Popover renderWithPortal={true} content={<DetailV1 />} header="Popover header">
Click me
</Popover>
),
},
{ key: 'progressbar', content: <ProgressBarV1 /> },
];

return (
<SimplePage title="Flashbar visual context" screenshotArea={{}}>
<SpaceBetween size="m">
{components.map(({ key, content }) => (
<Flashbar
key={key}
items={[
{ id: 'i', type: 'info', content: <div data-testid={`${key}-info`}>{content}</div> },
{ id: 'w', type: 'warning', content: <div data-testid={`${key}-warning`}>{content}</div> },
]}
/>
))}
</SpaceBetween>
</SimplePage>
);
}

function DetailV1() {
const [showModal, setShowModal] = useState(false);
return (
<SpaceBetween size="s" direction="horizontal">
<Box variant="span">Text</Box>
<Box variant="span" color="text-body-secondary">
secondary text
</Box>
<Button onClick={() => setShowModal(true)}>show modal</Button>
<Button variant="inline-link">inline link button</Button>
<Link>link</Link>
{showModal && (
<Modal visible={true} onDismiss={() => setShowModal(false)} header="Modal">
<DetailV2 />
</Modal>
)}
</SpaceBetween>
);
}

function DetailV2() {
return (
<KeyValuePairs
items={[
{
label: 'Distribution ID',
value: 'E1WG1ZNPRXT0D4',
info: (
<Link variant="info" href="#">
Info
</Link>
),
},
]}
/>
);
}

function ProgressBarV1() {
return (
<ProgressBar
variant="flash"
status="in-progress"
value={50}
label="Label"
description="Description"
additionalInfo="Additional info"
/>
);
}
Loading
Loading