-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1038d45
commit 91a2d79
Showing
1 changed file
with
15 additions
and
30 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,52 +1,37 @@ | ||
# Odigos UI Components | ||
# Odigos UI Utils | ||
|
||
## Installation | ||
|
||
Using **npm**: | ||
|
||
```shell | ||
npm i @odigos/ui-components | ||
npm i @odigos/ui-utils | ||
``` | ||
|
||
Using **yarn**: | ||
|
||
```shell | ||
yarn add @odigos/ui-components | ||
yarn add @odigos/ui-utils | ||
``` | ||
|
||
## Usage | ||
|
||
Wrap your app with the theme provider: | ||
Import a util, and call it with it's params: | ||
|
||
```tsx | ||
import { Theme } from '@odigos/ui-components' | ||
|
||
const AppProviders = () => { | ||
const darkMode = true | ||
|
||
return ( | ||
<Theme.Provider darkMode={darkMode}> | ||
<App /> | ||
</Theme.Provider> | ||
) | ||
} | ||
``` | ||
|
||
Import a component, and call it with it's props: | ||
|
||
```tsx | ||
import { Button, PlusIcon } from '@odigos/ui-components' | ||
import { useKeyDown } from '@odigos/ui-utils' | ||
|
||
const App = () => { | ||
const handleClick = () => { | ||
console.log('clicked') | ||
} | ||
|
||
return ( | ||
<Button onClick={handleClick}> | ||
<PlusIcon size={20} /> | ||
Add New... | ||
</Button> | ||
useKeyDown( | ||
{ | ||
key: 'Enter', | ||
active: true, | ||
}, | ||
() => { | ||
console.log('key pressed') | ||
} | ||
) | ||
|
||
return <div>hi mom</div> | ||
} | ||
``` |