Skip to content
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

feat: [DHIS2] Generate library documentation with Gen AI #1590

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions Prompts/generate-documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Documentation generation
You are an expert React documentation writer. You will be given a react component file. Your job is to generate documentation for the component. The documentation should be in markdown format.

## Format
1. The documentation should be in markdown format.
2. The documentation should be generated from the component file.
3. When importing a component, use `@dhis2/analytics` as the path.

## Suggested headers
1. Component name
2. Props
3. Usage
31 changes: 31 additions & 0 deletions docs/Filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Filter Component

The Filter component is a reusable input field component from the DHIS2 UI library. It is used to filter data based on the user's input.

## Props

- `text`: The current value of the input field. It is a string.
- `onChange`: A function that is called when the value of the input field changes. It is required.
- `onClear`: A function that is called when the input field is cleared. It is required.
- `placeholder`: The placeholder text for the input field. It is a required string.
- `type`: The type of the input field. It defaults to 'text'.
- `dataTest`: A string used for testing purposes.

## Usage
Here is an example of how to use the Filter component:

```jsx
import { Filter } from '@dhis2/analytics'

<Filter
text="Search text"
onChange={(value) => console.log(`New value: ${value}`)}
onClear={() => console.log('Input cleared')}
placeholder="Search..."
type="text"
dataTest="dhis2-uicore-filter"
/>
```

In this example, the `Filter` component is imported from the `@dhis2/analytics` package. The `text` prop is set to "Search text", the `onChange` prop is set to a function that returns 'True' if the value is truthy and 'False' otherwise, the `onClear` prop is set to a function that logs a message when the input is cleared, the `placeholder` prop is set to "Search...", the `type` prop is set to "text", and the `dataTest` prop is set to "dhis2-uicore-filter".

29 changes: 29 additions & 0 deletions docs/OrgUnitDimension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# OrgUnitDimension Component

The OrgUnitDimension component is a part of the DHIS2 analytics package. It is used to select organisation units, levels, and groups.

## Props

- `roots`: An array of strings representing the roots of the organisation units.
- `selected`: An array of objects representing the selected organisation units. Each object should have an `id` and `name` property, and may optionally have a `path` property.
- `onSelect`: A function that is called when an organisation unit is selected.
- `hideGroupSelect`: A boolean that determines whether the group select should be hidden. Defaults to `false`.
- `hideLevelSelect`: A boolean that determines whether the level select should be hidden. Defaults to `false`.
- `hideUserOrgUnits`: A boolean that determines whether the user organisation units should be hidden. Defaults to `false`.
- `warning`: A string that represents a warning message.

## Usage
```javascript
import { OrgUnitDimension } from '@dhis2/analytics'

<OrgUnitDimension
roots={['A0000001234']}
selected={[{ id: 'B0000001234', name: 'Unit B' }]}
onSelect={(selected) => console.log('Selected:', selected)}
hideGroupSelect={false}
hideLevelSelect={false}
hideUserOrgUnits={false}
warning="This is a warning message"
/>
```

Loading