Skip to content

feat: rich parameters: introduce display_name #6919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
UI changes
  • Loading branch information
mtojek committed Apr 3, 2023
commit 3ff3b62659059d0b6453cf4807350fe8151b9d1c
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,15 @@ DescriptionWithLinks.args = {
options: [],
}),
}

export const BasicWithDisplayName = Template.bind({})
BasicWithDisplayName.args = {
initialValue: "initial-value",
id: "project_name",
parameter: createTemplateVersionParameter({
name: "project_name",
display_name: "Project Name",
description:
"Customize the name of a Google Cloud project that will be created!",
}),
}
5 changes: 3 additions & 2 deletions site/src/components/RichParameterInput/RichParameterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ParameterLabelProps {
const ParameterLabel: FC<ParameterLabelProps> = ({ id, parameter }) => {
const styles = useStyles()
const hasDescription = parameter.description && parameter.description !== ""
const displayName = parameter.display_name ? parameter.display_name : parameter.name

return (
<label htmlFor={id}>
Expand All @@ -38,13 +39,13 @@ const ParameterLabel: FC<ParameterLabelProps> = ({ id, parameter }) => {

{hasDescription ? (
<Stack spacing={0.5}>
<span className={styles.labelCaption}>{parameter.name}</span>
<span className={styles.labelCaption}>{displayName}</span>
<span className={styles.labelPrimary}>
<MemoizedMarkdown>{parameter.description}</MemoizedMarkdown>
</span>
</Stack>
) : (
<span className={styles.labelPrimary}>{parameter.name}</span>
<span className={styles.labelPrimary}>{displayName}</span>
)}
</Stack>
</label>
Expand Down