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 view for text-content (#235)
- Loading branch information
1 parent
16174a1
commit a04374a
Showing
4 changed files
with
72 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
|
||
import {StringIndependentView} from '../../../core'; | ||
import {TextContentComponent, TextContentComponentProps} from '../Inputs'; | ||
|
||
export const TextContentView: StringIndependentView = ({name, spec, Layout, value}) => { | ||
const WrappedLayout = React.useMemo(() => { | ||
if (Layout) { | ||
const Component: TextContentComponentProps['Layout'] = (props) => { | ||
const VALUE_STUB = | ||
'if u see this, please create issue about it here: https://github.com/gravity-ui/dynamic-forms/issues/new'; | ||
|
||
return <Layout name={name} value={VALUE_STUB} {...props} />; | ||
}; | ||
|
||
return Component; | ||
} | ||
|
||
return undefined; | ||
}, [Layout, name]); | ||
|
||
return <TextContentComponent spec={spec} value={value} Layout={WrappedLayout} />; | ||
}; |
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