-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lots of RunIt form cleanup (#814)
Made some changes to the **RunIt** form, both for layout and editing various values ## Bug fixes - enum values are now a string input instead of `{}`. There is an outstanding task to support a dropdown picker for enums that will come with the next significant change for the form editor - DelimArray values are now a string input instead of `{}` ## Design improvements - all inputs are on a single line now, saving form space. This is particularly useful for endpoints with many input values ![image](https://user-images.githubusercontent.com/6099714/132744478-cd548230-7dd7-4148-9d6c-55e93b8bfef1.png) - date time picker is now a pop over with a button to choose the date (but still doesn't have time picking) ![image](https://user-images.githubusercontent.com/6099714/132928125-ca1d30fa-0d52-4265-bc77-e559c9ba09b8.png) - the default action for the form is now the first button, making it more convenient for tabbing through ![image](https://user-images.githubusercontent.com/6099714/132744727-e40cf9e2-ca85-4844-8c1a-bf576bd9680c.png)
- Loading branch information
Showing
9 changed files
with
366 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
MIT License | ||
Copyright (c) 2021 Looker Data Sciences, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
import React, { FC, ReactElement } from 'react' | ||
import { Space, Box, Label } from '@looker/components' | ||
|
||
interface FormItemProps { | ||
/** ID of input item for label */ | ||
id: string | ||
/** Optional label. Defaults to an empty string so spacing is preserved */ | ||
label?: string | ||
/** Nested react elements */ | ||
children: ReactElement | ||
} | ||
|
||
/** | ||
* basic input form layout component | ||
* @param id of input item | ||
* @param children embedded react elements | ||
* @param label optional label | ||
*/ | ||
export const FormItem: FC<FormItemProps> = ({ id, children, label = ' ' }) => { | ||
const key = `space_${id}` | ||
return ( | ||
<Space id={key} key={key}> | ||
<Box key={`${key}_box`} width="120px" flexShrink={0}> | ||
<Label key={`${key}_label_for`} htmlFor={id}> | ||
{label} | ||
</Label> | ||
</Box> | ||
{children} | ||
</Space> | ||
) | ||
} |
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.