-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): comment tools move over from old code (#16678)
closes AUTH-814
- Loading branch information
Showing
1 changed file
with
49 additions
and
2 deletions.
There are no files selected for viewing
51 changes: 49 additions & 2 deletions
51
protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/CommentTools/index.tsx
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 |
---|---|---|
@@ -1,3 +1,50 @@ | ||
export function CommentTools(): JSX.Element { | ||
return <div>TODO: wire this up</div> | ||
import { useTranslation } from 'react-i18next' | ||
import styled from 'styled-components' | ||
import { | ||
BORDERS, | ||
COLORS, | ||
DIRECTION_COLUMN, | ||
Flex, | ||
SPACING, | ||
StyledText, | ||
TYPOGRAPHY, | ||
} from '@opentrons/components' | ||
import type { ChangeEvent } from 'react' | ||
import type { StepFormProps } from '../../types' | ||
|
||
export function CommentTools(props: StepFormProps): JSX.Element { | ||
const { t, i18n } = useTranslation('form') | ||
const { propsForFields } = props | ||
|
||
return ( | ||
<Flex | ||
flexDirection={DIRECTION_COLUMN} | ||
gridGap={SPACING.spacing4} | ||
padding={SPACING.spacing16} | ||
> | ||
<StyledText desktopStyle="bodyDefaultRegular" color={COLORS.grey60}> | ||
{i18n.format(t('step_edit_form.field.comment.label'), 'capitalize')} | ||
</StyledText> | ||
<StyledTextArea | ||
value={propsForFields.message.value as string} | ||
onChange={(e: ChangeEvent<any>) => { | ||
propsForFields.message.updateValue(e.currentTarget.value) | ||
}} | ||
/> | ||
</Flex> | ||
) | ||
} | ||
|
||
// TODO: use TextArea component when we make it | ||
const StyledTextArea = styled.textarea` | ||
width: 100%; | ||
height: 7rem; | ||
box-sizing: border-box; | ||
border: 1px solid ${COLORS.grey50}; | ||
border-radius: ${BORDERS.borderRadius4}; | ||
padding: ${SPACING.spacing8}; | ||
font-size: ${TYPOGRAPHY.fontSizeH4}; | ||
line-height: ${TYPOGRAPHY.lineHeight16}; | ||
font-weight: ${TYPOGRAPHY.fontWeightRegular}; | ||
resize: none; | ||
` |