complete interface docs

This commit is contained in:
Luke committed 2022-09-17 12:24:48 +02:00
1 parent d44c42104e
commit c7a4aca477
4 files changed
+442 -132

No files matched your search

+118 -32
View File
@@ -5,35 +5,49 @@ title: Notifications
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
### lib.notify
## lib.notify
Custom notifications with a lot of styling options.
<Tabs>
<TabItem value='Lua'>
```lua
-- id: string (optional)
-- title: string (if description then optional)
-- description: string (if title then optional)
-- duration: number (optional)
-- position: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' (optional)
-- type: 'inform' | 'error' | 'success'
-- style: table (optional)
-- icon: string (optional)
-- iconColor: string (optional)
lib.notify(data)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.notify(data)
```
`id` - When set the current notification will be unique and only shown once on screen
`title` - Must provide if there is no description
`description` - Must provide if there is no title
`position` - Default: `'top-right'`
`type` - Default: `'inform'`
`style` - React CSS styling, works the same as in [TextUI](textui.md)
`icon` - Font Awesome 6 icon, works the same as in [TextUI](textui.md)
`iconColor` - Set a different color for the provided icon
</TabItem>
</Tabs>
* id?: `string`
* When set the current notification will be unique and only shown once on screen when spammed.
* title?: `string`
* Must provide if there is no description
* description?: `string`
* Must provide if there is no title
* duration?: `number`
* position?: `'top'` or `'top-right'` or `'top-left'` or `'bottom'` or `'bottom-right'` or `'bottom-left'`
* Default: `'top-right'`
* type: `'inform'` or `'error'` or `'success'`
* Default: `'inform'`
* style?: `table` (`object`)
* React CSS styling format
* icon?: `string`
* Font Awesome 6 icon name
* iconColor: `string`
### Usage Example
### Standard
**Example:**
<Tabs>
<TabItem value='standard' label="Standard">
<TabItem value='Lua'>
```lua
lib.notify({
@@ -42,9 +56,27 @@ lib.notify({
type = 'success'
})
```
![notification](https://i.imgur.com/cRxJICO.png)
</TabItem>
<TabItem value='custom' label="Custom">
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.notify({
title: 'Notification title',
description: 'Notification description',
type: 'success'
})
```
</TabItem>
</Tabs>
![notification](https://i.imgur.com/cRxJICO.png)
### Custom
<Tabs>
<TabItem value='Lua'>
```lua
lib.notify({
@@ -60,25 +92,64 @@ lib.notify({
iconColor = '#C53030'
})
```
![custom_notification](https://i.imgur.com/0EK5APp.png)
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.notify({
id: 'some_identifier',
title: 'Notification title',
description: 'Notification description',
position: 'top',
style: {
backgroundColor: '#141517',
color: '#909296'
},
icon: 'ban',
iconColor: '#C53030'
})
```
</TabItem>
</Tabs>
### lib.defaultNotify
![custom_notification](https://i.imgur.com/0EK5APp.png)
## lib.defaultNotify
Default notifications provided by Chakra UI.
<Tabs>
<TabItem value='Lua'>
```lua
-- title: string (if description then optional)
-- description: string (if title then optional)
-- duration: number (optional)
-- position: ToastPositionWithLogical (optional)
-- status: "info" | "warning" | "success" | "error" (optional)
-- id: number (optional)
lib.defaultNotify(data)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.defaultNotify(data)
```
</TabItem>
</Tabs>
**Example:**
* id?: `number`
* Same as id in `lib.notify`
* title?: `string`
* description?: `string`
* duration?: `number`
* position?: `'top'` or `'top-right'` or `'top-left'` or `'bottom'` or `'bottom-right'` or `'bottom-left'`
* status?: `'info'` or `'warning'` or `'success'` or `'error'`
### Usage Example
<Tabs>
<TabItem value='Lua'>
```lua
lib.defaultNotify({
@@ -87,4 +158,19 @@ lib.defaultNotify({
status = 'success'
})
```
![default_notification](https://i.imgur.com/EIibuY9.png)
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.defaultNotify({
title: 'Notification title',
description: 'Notification description',
status: 'success'
})
```
</TabItem>
</Tabs>
![default_notification](https://i.imgur.com/EIibuY9.png)