generated from gravity-ui/package-example
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flat oneof input, add oneof params to object spec
- Loading branch information
1 parent
0274582
commit 739bdcf
Showing
16 changed files
with
211 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import '../../../styles/variables'; | ||
|
||
.#{$ns}oneof-view { | ||
&_flat { | ||
& > .#{$ns}group-indent { | ||
margin: 0 0 20px; | ||
border-left: none; | ||
padding: 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './OneOfView'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
|
||
import {ComponentStory} from '@storybook/react'; | ||
|
||
import {ObjectSpec, OneOfFlat as OneOfFlatBase, SpecTypes} from '../lib'; | ||
|
||
import {InputPreview} from './components'; | ||
|
||
export default { | ||
title: 'Object/OneOfFlat', | ||
component: OneOfFlatBase, | ||
}; | ||
|
||
const baseSpec: ObjectSpec = { | ||
type: SpecTypes.Object, | ||
properties: { | ||
internal: { | ||
required: true, | ||
type: SpecTypes.String, | ||
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Person id'}, | ||
}, | ||
empty: { | ||
required: true, | ||
type: SpecTypes.Object, | ||
viewSpec: {type: 'base', layoutTitle: 'Empty'}, | ||
}, | ||
external: { | ||
required: true, | ||
type: SpecTypes.Object, | ||
properties: { | ||
name: { | ||
type: SpecTypes.String, | ||
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Name'}, | ||
}, | ||
age: { | ||
type: SpecTypes.Number, | ||
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Age'}, | ||
}, | ||
license: { | ||
type: SpecTypes.Boolean, | ||
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'License'}, | ||
}, | ||
}, | ||
viewSpec: { | ||
type: 'base', | ||
layoutTitle: 'Person data', | ||
}, | ||
}, | ||
}, | ||
description: { | ||
external: 'External candidate', | ||
internal: 'Internal candidate', | ||
empty: 'None', | ||
}, | ||
viewSpec: { | ||
type: 'oneof_flat', | ||
layout: 'row', | ||
layoutTitle: 'Candidate', | ||
order: ['external', 'internal', 'empty'], | ||
}, | ||
}; | ||
|
||
const excludeOptions = ['viewSpec.type']; | ||
|
||
const template = (spec: ObjectSpec = baseSpec) => { | ||
const Template: ComponentStory<typeof OneOfFlatBase> = (__, {viewMode}) => ( | ||
<InputPreview spec={spec} excludeOptions={excludeOptions} viewMode={viewMode} /> | ||
); | ||
|
||
return Template; | ||
}; | ||
|
||
export const OneOfFlat = template(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.