Skip to content

Commit a14ff6c

Browse files
committed
feat: Added description for properties in the main page
1 parent 2db86ad commit a14ff6c

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/Form.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ export const Form: React.FC<FormProps> = props => {
125125
onChangeTab(Math.min(currentTab, sections.length - 2));
126126
}
127127

128+
const upperFirstLetter = (s?: string): string | undefined => {
129+
if (!s) {
130+
return s;
131+
}
132+
return s.charAt(0).toUpperCase() + s.slice(1)
133+
}
134+
128135
return (
129136
<FullScreen>
130137
<Box width="100%" height="90%" flexDirection="column" overflowY="hidden">
@@ -166,6 +173,15 @@ export const Form: React.FC<FormProps> = props => {
166173
<Box marginX={1} flexDirection='column'>
167174
<Text underline>Description:</Text>
168175
<DescriptionRenderer description={sections[currentTab]?.description} />
176+
{
177+
sections[currentTab].fields[focusedElement]?.description && (
178+
<Box flexDirection="column">
179+
<Text> </Text>
180+
<Text underline>{upperFirstLetter(sections[currentTab].fields[focusedElement]?.label)}:</Text>
181+
<DescriptionRenderer description={sections[currentTab].fields[focusedElement]?.description} />
182+
</Box>
183+
)
184+
}
169185
</Box>
170186
)}
171187
</Box>

src/demo/Test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export function Test() {
4646
{
4747
title: "asdf-global",
4848
fields: [
49-
{ type: 'string', name: 'plugin', label: 'plugin', required: true },
50-
{ type: 'string', name: 'version', label: 'version', required: true },
49+
{ type: 'string', name: 'plugin', label: 'plugin', required: true, description: 'The plugin to install' },
50+
{ type: 'string', name: 'version', label: 'version', required: true, description: 'The version to install' },
5151
],
5252
description: 'Asdf global sets the global version of a asdf installed plugin.'
5353
},

0 commit comments

Comments
 (0)