mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Rename files
This commit is contained in:
80
ts/components/CountryCodeSelect.dom.stories.tsx
Normal file
80
ts/components/CountryCodeSelect.dom.stories.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import type { PropsType } from './CountryCodeSelect.dom.js';
|
||||
import { CountryCodeSelect } from './CountryCodeSelect.dom.js';
|
||||
import { type ComponentMeta } from '../storybook/types.std.js';
|
||||
|
||||
const { i18n } = window.SignalContext;
|
||||
|
||||
type StoryPropsType = Omit<PropsType, 'value' | 'onChange'>;
|
||||
|
||||
const DEMO_COUNTRIES = [
|
||||
{
|
||||
displayName: 'Belgium',
|
||||
region: 'BE',
|
||||
code: '+32',
|
||||
},
|
||||
{
|
||||
displayName: 'Canada',
|
||||
region: 'CA',
|
||||
code: '+1',
|
||||
},
|
||||
{
|
||||
displayName: 'France',
|
||||
region: 'FR',
|
||||
code: '+33',
|
||||
},
|
||||
{
|
||||
displayName: 'Germany',
|
||||
region: 'DE',
|
||||
code: '+49',
|
||||
},
|
||||
{
|
||||
displayName: 'Hong Kong',
|
||||
region: 'HK',
|
||||
code: '+852',
|
||||
},
|
||||
{
|
||||
displayName: 'Spain',
|
||||
region: 'ES',
|
||||
code: '+34',
|
||||
},
|
||||
{
|
||||
displayName: 'Switzerland',
|
||||
region: 'CH',
|
||||
code: '+41',
|
||||
},
|
||||
{
|
||||
displayName: 'USA',
|
||||
region: 'US',
|
||||
code: '+1',
|
||||
},
|
||||
{
|
||||
displayName: 'Japan',
|
||||
region: 'JP',
|
||||
code: '+81',
|
||||
},
|
||||
];
|
||||
|
||||
function Template(args: StoryPropsType): JSX.Element {
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
return <CountryCodeSelect {...args} value={value} onChange={setValue} />;
|
||||
}
|
||||
|
||||
export default {
|
||||
title: 'Components/CountryCodeSelect',
|
||||
component: Template,
|
||||
argTypes: {},
|
||||
args: {
|
||||
i18n,
|
||||
defaultRegion: 'US',
|
||||
countries: DEMO_COUNTRIES,
|
||||
},
|
||||
} satisfies ComponentMeta<StoryPropsType>;
|
||||
|
||||
export function Defaults(args: StoryPropsType): JSX.Element {
|
||||
return <Template {...args} />;
|
||||
}
|
||||
Reference in New Issue
Block a user