summaryrefslogtreecommitdiff
path: root/README.md
blob: a177def645677f7765f8ea7614f66be2f182fad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# re-patternfly

ReasonML/ReScript binding for [patternfly][patternfly].

## Features

Components (generated from the typescript interfaces):

- AboutModal
- Accordion
- Alert
- AlertGroup
- ApplicationLauncher
- Avatar
- Backdrop
- BackgroundImage
- Badge
- Banner
- Brand
- Breadcrumb
- Button
- Card
- Checkbox
- ClipboardCopy
- DescriptionList
- Divider
- Drawer
- Drawer
- Dropdown
- EmptyState
- Form
- Hint
- Label
- LabelGroup
- List
- LoginPage
- Menu
- Nav
- Page
- Radio
- Spinner
- Tabs
- Text
- TextArea
- TextInput
- Tile
- Title
- Toolbar

Layouts:

- Bullseye
- Gallery
- Grid
- Level
- Split
- Stack

Table component supports this data definition:

```reason
let make = () => {
  let columns = [|
    {title: "job", transforms: [|sortable|]},
    {title: "result", transforms: [|sortable|]},
  |];
  let (rows, setRows) =
    React.useState(_ =>
      [|
        {cells: [|"rpmbuild", "success"|]},
        {cells: [|"rpmtest", "failure"|]},
      |]
    );
  let onSort = _ => setRows(_ => Belt.Array.reverse(rows));

  <Table caption="Sortable Table" rows cells=columns onSort>
    <TableHeader />
    <TableBody />
  </Table>;
};
```

## Install

Add to your `package.json`:

```
npm install @softwarefactory-project/re-patternfly
```

Or using yarn:

```
yarn add @softwarefactory-project/re-patternfly
```

Add to your `bsconfig.json`:

```diff
"bs-dependencies": [
+  "@softwarefactory-project/re-patternfly"
]
```

## Example

```reason
[@react.component]
let make = () => {
  <Patternfly.List>
    <Patternfly.ListItem>
      {"Hello patternfly!" |> React.string}
    </Patternfly.ListItem>
  </Patternfly.List>
};
```

See the [demo](./demo) directory for a starter project.

## Contribute

Contributions are most welcome, for example the project needs help to:

- bind more component.
- better documentation and demo project.

Get started by running:

```sh
git clone https://github.com/softwarefactory-project/re-patternfly
cd re-patternfly
npm install
npm start
```

Then build and run tests with `npm test`.

Make sure to read about [React][reason-react] and [ReScript][rescript-lang] too.

## Changes

### 1.0.0

- Initial release

[patternfly]: https://www.patternfly.org/v4/
[reason-react]: https://reasonml.github.io/reason-react/docs/en/components
[rescript-lang]: https://rescript-lang.org/docs/manual/v8.0.0/overview