Skip to content

Commit

Permalink
feat(EditableField): added unit prop to EditableField.Text DHP-1056 (
Browse files Browse the repository at this point in the history
  • Loading branch information
giubatt authored May 26, 2022
1 parent 65e8bd0 commit 37debed
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .creevey/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ module.exports = {
browsers: {
chrome: {
browserName: 'chrome',
version: '101.0',
// Define initial viewport size
viewport: { width: 1024, height: 768 },
// Increase parallel sessions
limit: 2,
},
firefox: {
browserName: 'firefox',
version: '99.0',
viewport: { width: 1024, height: 768 },
limit: 2,
},
Expand Down
14 changes: 14 additions & 0 deletions src/components/EditableField/Text/EditableFieldText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface EditableFieldTextProps {
// When true renders a textarea instead of an input
multiline?: boolean
rows?: number
unit?: string
}

const EditableText = forwardRef<
Expand All @@ -57,6 +58,7 @@ const EditableText = forwardRef<
controlsGroup = false,
multiline,
rows = 1,
unit,
}: EditableFieldTextProps,
ref
) {
Expand Down Expand Up @@ -279,6 +281,18 @@ const EditableText = forwardRef<
}}
/>
)}
{unit && (
<label
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
color: "text.40",
}}
>
{unit}
</label>
)}
{
{
default: "",
Expand Down
6 changes: 6 additions & 0 deletions src/components/EditableField/Text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Default.args = {
value: "Handle 123",
}

export const WithUnit = Template.bind({})
WithUnit.args = {
value: "123",
unit: "cm",
}

export const Loading = Template.bind({})
Loading.args = {
value: "Handle 123",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 37debed

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for herzui ready!

✅ Preview
https://herzui-5k73i140w-micromed.vercel.app

Built with commit 37debed.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.