-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from codytodonnell/main
Prep package for publishing
- Loading branch information
Showing
10 changed files
with
150 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,48 @@ | ||
# React + TypeScript + Vite | ||
# STRUDEL Components | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
STRUDEL Components are a set of react components that support people developing UI applications for the scientific community. They are built on top of [Material UI components](https://mui.com/) and aim to provide an extra layer of implementation to promote positive user experiences and usability standards. | ||
|
||
Currently, two official plugins are available: | ||
Key Features: | ||
- Specialized data grid for displaying scientific data | ||
- Chemical formula rendering component | ||
- Filters component for managing complex filter states | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
[Check out the documentation on the STRUDEL Kit site.](https://strudel.science/strudel-kit/docs/components/overview) | ||
|
||
## Expanding the ESLint configuration | ||
They also provide the building blocks for the STRUDEL Task Flow templates. [Learn how to get started with the full templates](https://strudel.science/strudel-kit/docs/). | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
## Install | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
``` | ||
npm install @strudel-science/components | ||
``` | ||
|
||
## Usage | ||
|
||
### [Examples](https://github.com/strudel-science/strudel-kit/tree/main/strudel-components/src/examples) | ||
|
||
### Import | ||
|
||
```js | ||
import { SciDataGrid } from '@strudel-science/components'; | ||
``` | ||
|
||
```js | ||
import { Filters, FilterGroup, FilterField } from '@strudel-science/components'; | ||
``` | ||
|
||
```js | ||
import { LabelValueTable } from '@strudel-science/components'; | ||
``` | ||
|
||
```js | ||
export default { | ||
// other rules... | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './tsconfig.node.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
} | ||
import { Formula } from '@strudel-science/components'; | ||
``` | ||
|
||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` | ||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list | ||
```js | ||
import { CheckboxList } from '@strudel-science/components'; | ||
``` | ||
|
||
```js | ||
import { PageHeader } from '@strudel-science/components'; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
strudel-components/src/examples/CheckboxList/CheckboxListEx.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useState } from "react"; | ||
import { CheckboxList } from "../../../lib/main" | ||
import { CheckboxOptionValue } from "../../../lib/components/CheckboxList"; | ||
|
||
export const CheckboxListEx: React.FC = () => { | ||
const [values, setValues] = useState<CheckboxOptionValue[] | null>(null); | ||
|
||
const handleChange = (values: CheckboxOptionValue[] | null) => { | ||
setValues(values); | ||
} | ||
|
||
return ( | ||
<CheckboxList | ||
values={values} | ||
onChange={handleChange} | ||
options={[ | ||
{ | ||
label: 'Checkbox 1', | ||
value: 1 | ||
}, | ||
{ | ||
label: 'Checkbox 2', | ||
value: 2 | ||
} | ||
]} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Formula } from "../../../lib/main" | ||
|
||
export const FormulaEx: React.FC = () => { | ||
return ( | ||
<Formula content="C2H5OH" /> | ||
) | ||
} |
22 changes: 22 additions & 0 deletions
22
strudel-components/src/examples/LabelValueTable/LabelValueTableEx.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { LabelValueTable } from "../../../lib/main" | ||
|
||
export const LabelValueTableEx: React.FC = () => { | ||
return ( | ||
<LabelValueTable | ||
rows={[ | ||
{ | ||
label: 'Attribute 1', | ||
value: 'Value 1', | ||
}, | ||
{ | ||
label: 'Attribute 2', | ||
value: 'Value 2', | ||
}, | ||
{ | ||
label: 'Attribute 3', | ||
value: 'Value 3', | ||
} | ||
]} | ||
/> | ||
) | ||
} |
Empty file.
Oops, something went wrong.