Skip to content

Commit

Permalink
Automate method form conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
amalvijayan03 committed Jan 25, 2024
1 parent a9b21f4 commit 81e357e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const combinedSchema = (options, selectedOption) => {
component: componentTypes.TEXT_FIELD,
id: 'built-in',
name: 'built-in',
label: __('Optional, if not specified, method name is used'),
label: __('Builtin name'),
helperText: 'Optional, if not specified, method name is used',
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React from 'react';
import {
DataTable,
} from 'carbon-components-react';
import { DataTable } from 'carbon-components-react';

const InputParams = () => {
/**SAmple data */
const data = [
{ inputName: 'username', dataType: 'string', defaultValue: 'guest', actions: 'Edit, Delete' },
{ inputName: 'password', dataType: 'password', defaultValue: '********', actions: 'Edit, Delete' },
{ id: '1', inputName: 'username', dataType: 'string', defaultValue: 'guest', actions: 'Edit, Delete' },
{ id: '2', inputName: 'password', dataType: 'password', defaultValue: '********', actions: 'Edit, Delete' },
];

const headers = [
Expand All @@ -21,36 +18,27 @@ const InputParams = () => {
<DataTable
rows={data}
headers={headers}
render={({
rows,
headers,
getHeaderProps,
getRowProps,
getTableProps,
getTableContainerProps,
}) => (
<div {...getTableContainerProps()}>
<table {...getTableProps()} className="bx--data-table">
<thead>
<tr>
render={({ rows, headers, getHeaderProps, getRowProps, getTableProps }) => (
<table {...getTableProps()} className="bx--data-table">
<thead>
<tr>
{headers.map((header) => (
<th key={header.key} {...getHeaderProps({ header })}>
{header.header}
</th>
))}
</tr>
</thead>
<tbody>
{rows.map((row) => (
<tr key={row.id} {...getRowProps({ row })}>
{headers.map((header) => (
<th key={header.key} {...getHeaderProps({ header })}>
{header.header}
</th>
<td key={header.key}>{row[header.key]}</td>
))}
</tr>
</thead>
<tbody>
{rows.map((row) => (
<tr key={row.id} {...getRowProps({ row })}>
{headers.map((header) => (
<td key={header.key}>{row[header.key]}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
))}
</tbody>
</table>
)}
/>
);
Expand Down

0 comments on commit 81e357e

Please sign in to comment.