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

Added options for middle-left and middle-right notifications #18

Merged
merged 4 commits into from
Sep 22, 2021
Merged
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
4 changes: 2 additions & 2 deletions docs/starting.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ T-Notify includes a small config that allows for various changes to how the reso
debugMode = true --Toggle developer prints
}

* **Position** - Will change the positioning of the notifications (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right)
* **Position** - Will change the positioning of the notifications (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right, middle-left, middle-right)
* **maxNotifications** - The max number of notifications to show on-screen at once.
* **Sound** - Allows for the change of the notification alert sound. Reference [this](https://wiki.gtanet.work/index.php?title=FrontEndSoundlist) for options.
* *name* - Sound Name
Expand All @@ -46,4 +46,4 @@ T-Notify includes a small config that allows for various changes to how the reso
* *insertDuration* - Insert animation duration in *ms*
* *removeAnimation* - Remove animation ('fadeout', 'scaleout', 'rotateout')
* *removeDuration* - Remove animation duration in *ms*
* **debugMode** - Toggle showing developer prints in console.
* **debugMode** - Toggle showing developer prints in console.
10 changes: 5 additions & 5 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Depending on the function, the object can have optional and required properties.
* `name` {STRING} (Optional) - An audio name like what can be found in `config.lua`
* `reference` {STRING} (Optional) - An audio reference like what can be found in `config.lua`
* `custom` {BOOL} (Optional) - This ***must*** be set to true in order to utilize a custom style. *Defaults to false.*
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right) *Defaults to config*
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right, middle-left, middle-right) *Defaults to config*
* **Custom**
* `style` {STRING} (Required) - One of the available styles as listed in the **[base styling](usage?id=base-styling)** section.
* `title` {STRING} (Optional) - Title to display in the notification. *Defaults to nil*
Expand All @@ -109,7 +109,7 @@ Depending on the function, the object can have optional and required properties.
* `name` {STRING} (Optional) - An audio name like what can be found in `config.lua`
* `reference` {STRING} (Optional) - An audio reference like what can be found in `config.lua`
* `custom` {BOOL} (Optional) - This ***must*** be set to true in order to utilize a custom style that wasn't present by default. *Defaults to false*.
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right) *Defaults to config*
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right, middle-left, middle-right) *Defaults to config*
* **Image**
* `style` {STRING} (Required) - One of the available styles as listed in the **[base styling](usage?id=base-styling)** section.
* `title` {STRING} (Optional) - Title to display in the notification. *Defaults to nil*
Expand All @@ -119,7 +119,7 @@ Depending on the function, the object can have optional and required properties.
* `name` {STRING} (Optional) - An audio name like what can be found in `config.lua`
* `reference` {STRING} (Optional) - An audio reference like what can be found in `config.lua`
* `custom` {BOOL} (Optional) - This ***must*** be set to true in order to utilize a custom style that wasn't present by default. *Defaults to false*.
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right) *Defaults to config*
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right, middle-left, middle-right) *Defaults to config*
* **Persistent**
* `step` {STRING} (Required) - The specific step for the persistent notification call (start, update, end).
* `id` {STRING} (Required) - The unique id for the persistent notification being called. This must be a unique id to each persistent notification.
Expand All @@ -131,7 +131,7 @@ Depending on the function, the object can have optional and required properties.
* `name` {STRING} (Optional) - An audio name like what can be found in `config.lua`
* `reference` {STRING} (Optional) - An audio reference like what can be found in `config.lua`
* `custom` {BOOL} (Optional) - This ***must*** be set to true in order to utilize a custom style that wasn't present by default. *Defaults to false*.
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right) *Defaults to config value*
* `position` {STRING} (Optional) - Position of the notification to display (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right, middle-left, middle-right) *Defaults to config value*

### Examples

Expand Down Expand Up @@ -343,4 +343,4 @@ exports['t-notify']:Custom({

This code snippet produced the following notification:

![Colors Example](https://camo.githubusercontent.com/f03940f6150420145ef63d5b82a6eaa0ec7ed65f0407c126088cb6f207be0b09/68747470733a2f2f692e7461736f6167632e6465762f42786b77)
![Colors Example](https://camo.githubusercontent.com/f03940f6150420145ef63d5b82a6eaa0ec7ed65f0407c126088cb6f207be0b09/68747470733a2f2f692e7461736f6167632e6465762f42786b77)
14 changes: 13 additions & 1 deletion nui/SimpleNotification/notification.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@
justify-content: flex-end;
}

.gn-middle-left {
justify-content: center;
align-items: flex-start;
flex-direction: column;
}

.gn-middle-right {
justify-content: center;
align-items: flex-end;
flex-direction: column;
}

.gn-notification {
flex-shrink: 0;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
Expand Down Expand Up @@ -438,4 +450,4 @@

.gn-float-right {
float: right;
}
}
8 changes: 7 additions & 1 deletion nui/SimpleNotification/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@ class SimpleNotification {
case 'bottom-center':
this.options.insertAnimation.name = 'insert-bottom';
break;
case 'middle-left':
this.options.insertAnimation.name = 'insert-left';
break;
case 'middle-right':
this.options.insertAnimation.name = 'insert-right';
break;
}
}
if (this.options.insertAnimation.name == this.options.removeAnimation.name) {
Expand Down Expand Up @@ -996,4 +1002,4 @@ SimpleNotification.tags = {
open: '~gy~',
close: '~gy~'
}
};
};