-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from Smithsonian/develop
v0.9.0 Merge!
- Loading branch information
Showing
192 changed files
with
6,859 additions
and
2,298 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
/** | ||
* TextArea | ||
* | ||
* This component renders a textarea form control component. | ||
*/ | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import React from 'react'; | ||
import { DebounceInput } from 'react-debounce-input'; | ||
import { ViewableProps } from '../../types/repository'; | ||
import FieldType from '../shared/FieldType'; | ||
|
||
const useStyles = makeStyles(({ palette, typography }) => ({ | ||
description: { | ||
height: ({ height, rows }: TextAreaProps) => rows ? 'undefined' : height, | ||
width: '80%', | ||
padding: 10, | ||
resize: 'none', | ||
overflow: 'scroll', | ||
border: `${palette.primary.contrastText}, 0.4`, | ||
backgroundColor: palette.background.paper, | ||
borderRadius: 5, | ||
fontWeight: typography.fontWeightRegular, | ||
fontFamily: typography.fontFamily, | ||
fontSize: '0.8em' | ||
} | ||
})); | ||
|
||
interface TextAreaProps extends ViewableProps { | ||
label?: string; | ||
value?: number | string | null; | ||
name: string; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
error?: boolean; | ||
placeholder?: string; | ||
height?: string; | ||
rows?: string; | ||
} | ||
|
||
function TextArea(props: TextAreaProps): React.ReactElement { | ||
const { label, name, value, onChange, required = false, viewMode = false, disabled = false, placeholder, rows } = props; | ||
const classes = useStyles(props); | ||
|
||
const rowFieldProps = { alignItems: 'center', justifyContent: 'space-between', style: { borderRadius: 0 } }; | ||
return ( | ||
(label ? | ||
<FieldType | ||
required={required} | ||
label={label ?? ''} | ||
direction='row' | ||
containerProps={rowFieldProps} | ||
width={viewMode ? 'auto' : undefined} | ||
> | ||
<DebounceInput | ||
forceNotifyByEnter={false} | ||
element={'textarea'} | ||
disabled={disabled} | ||
value={value || ''} | ||
className={classes.description} | ||
name={name} | ||
onChange={onChange} | ||
debounceTimeout={400} | ||
placeholder={placeholder} | ||
rows={rows} | ||
/> | ||
</FieldType> : | ||
<DebounceInput | ||
forceNotifyByEnter={false} | ||
element={'textarea'} | ||
disabled={disabled} | ||
value={value || ''} | ||
className={classes.description} | ||
name={name} | ||
onChange={onChange} | ||
debounceTimeout={400} | ||
placeholder={placeholder} | ||
rows={rows} | ||
/> | ||
) | ||
); | ||
} | ||
|
||
export default TextArea; |
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,27 @@ | ||
/** | ||
* ToolTip | ||
* | ||
* This custom component is used in the MUI Tooltip component to allow for greater customization, such as line breaks. | ||
*/ | ||
import React from 'react'; | ||
|
||
export interface ToolTipProps { | ||
text: string; | ||
} | ||
|
||
export function ToolTip(props: ToolTipProps): React.ReactElement { | ||
const { text } = props; | ||
const lines = text.split('\n'); | ||
const content = lines.map((line, index) => { | ||
return ( | ||
<span key={index} style={{ display: 'block' }}> | ||
{line} | ||
</span> | ||
); | ||
}); | ||
return ( | ||
<> | ||
{content} | ||
</> | ||
); | ||
} |
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
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.