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

feat #84 - Radio group component #91

Merged
merged 4 commits into from
Sep 20, 2020
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dassana-io/web-components",
"version": "0.3.1",
"version": "0.3.2",
"publishConfig": {
"registry": "https://npm.pkg.github.com/dassana-io"
},
Expand Down
259 changes: 259 additions & 0 deletions src/__snapshots__/storybook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,95 @@ exports[`Storyshots Form Default 1`] = `
</div>
</div>
</div>
<div>
<div
className="container-0-2-5 required-0-2-6"
>
Severity
</div>
<div
className="ant-radio-group ant-radio-group-solid"
>
<label
className="ant-radio-button-wrapper"
>
<span
className="ant-radio-button"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={false}
name="radioGroup-field-severity"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="high"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
High
</span>
</label>
<label
className="ant-radio-button-wrapper"
>
<span
className="ant-radio-button"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={false}
name="radioGroup-field-severity"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="medium"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Medium
</span>
</label>
<label
className="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
className="ant-radio-button ant-radio-button-checked"
style={Object {}}
>
<input
checked={true}
className="ant-radio-button-input"
disabled={false}
name="radioGroup-field-severity"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="low"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Low
</span>
</label>
</div>
</div>
<button
className="ant-btn ant-btn-default"
data-test="button-submit-button"
Expand Down Expand Up @@ -507,6 +596,176 @@ exports[`Storyshots Notifications Warning 1`] = `
</button>
`;

exports[`Storyshots Radio Group Default 1`] = `
<div
className="ant-radio-group ant-radio-group-solid"
>
<label
className="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
className="ant-radio-button ant-radio-button-checked"
style={Object {}}
>
<input
checked={true}
className="ant-radio-button-input"
disabled={false}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="high"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
High
</span>
</label>
<label
className="ant-radio-button-wrapper"
>
<span
className="ant-radio-button"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={false}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="medium"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Medium
</span>
</label>
<label
className="ant-radio-button-wrapper"
>
<span
className="ant-radio-button"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={false}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="low"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Low
</span>
</label>
</div>
`;

exports[`Storyshots Radio Group Partially Disabled 1`] = `
<div
className="ant-radio-group ant-radio-group-solid"
>
<label
className="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
className="ant-radio-button ant-radio-button-checked"
style={Object {}}
>
<input
checked={true}
className="ant-radio-button-input"
disabled={false}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="high"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
High
</span>
</label>
<label
className="ant-radio-button-wrapper"
>
<span
className="ant-radio-button"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={false}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="medium"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Medium
</span>
</label>
<label
className="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
className="ant-radio-button ant-radio-button-disabled"
style={Object {}}
>
<input
checked={false}
className="ant-radio-button-input"
disabled={true}
name="radioGroup"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="low"
/>
<span
className="ant-radio-button-inner"
/>
</span>
<span>
Low
</span>
</label>
</div>
`;

exports[`Storyshots Select Default 1`] = `
<div
className="container-0-2-13 container-d1-0-2-24"
Expand Down
12 changes: 11 additions & 1 deletion src/components/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { basicOptions } from '../RadioGroup/fixtures/sample_options'
import { iconOptions } from '../Select/fixtures/sample_options'
import React from 'react'
import Form, { FormProps } from './index'
Expand All @@ -20,7 +21,10 @@ interface UserModel {
const Template: Story<FormProps<UserModel>> = (args: FormProps<UserModel>) => (
<Form
{...args}
initialValues={{ cloudType: 'azure', firstName: 'First Name' }}
initialValues={{
cloudType: 'azure',
firstName: 'First Name'
}}
>
<Form.Input label='First Name' name='firstName' required />
<Form.Input label='Last Name' name='lastName' />
Expand All @@ -29,6 +33,12 @@ const Template: Story<FormProps<UserModel>> = (args: FormProps<UserModel>) => (
name='cloudType'
options={iconOptions}
/>
<Form.RadioGroup
defaultValue='low'
label='Severity'
name='severity'
options={basicOptions}
/>
<Form.SubmitButton>Submit</Form.SubmitButton>
</Form>
)
Expand Down
Loading