/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * * OpenCRVS is also distributed under the terms of the Civil Registration * & Healthcare Disclaimer located at http://opencrvs.org/license. * * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ import { Meta, Story } from '@storybook/react' import { ListViewSimplified, ListViewItemSimplified } from './ListViewSimplified' import React from 'react' import { ToggleMenu } from '../ToggleMenu' import { AvatarSmall, AvatarLarge } from '../icons' import { Icon } from '../Icon' import { Pill } from '../Pill' import styled from 'styled-components' import { Link } from '../Link' import { Button } from '../Button' const Template: Story = ({ children, ...args }) => { return {children} } export default { title: 'Data/List view', component: ListViewSimplified } as Meta const toggleMenu = ( } menuItems={[ { label: 'Item 1', handler: () => { alert('Item 1') } } ]} /> ) const linkButton = ( Change ) const linkLabel = (i: number) => Link {i} const button = ( ) const pill = const TopAlignedLabel = styled.span` align-self: start; padding-top: 8px; ` const TopAlignedActions = styled.div` align-self: start; display: flex; gap: 8px; ` export const Default = Template.bind({}) Default.args = { bottomBorder: true, children: ( <> {button} {toggleMenu} } /> Label 5} value={} actions={ {linkButton} {toggleMenu} } /> ) } export const WithAvatar = Template.bind({}) WithAvatar.args = { children: ( <> } label="Name of user" value="Value 1" actions={ <> {pill} {toggleMenu} } /> } label="A very long label to show what happens when text overflows" value="A very long value to show what happens when text overflows" actions={linkButton} /> } label="Name of user" value="Value 3" actions={toggleMenu} /> } label="Name of user" value="Value 4" actions={ <> {pill} {toggleMenu} } /> } label="Name of user" value="Value 5" actions={toggleMenu} /> ) } export const PlainList = Template.bind({}) PlainList.args = { children: ( <> ) }