Task/improve hardcoded styles and types (#107)

* Add working notifications with only twitter for now

* feat(notification-bar): I didnt copy from NP

* feat(notifications): Collapse when no more notifications after closing one

* Improve overall messages styling code

* Improve Routing performance

* improve use keyboard hook

* Remove unused returns

* Button hover color :)

* Button hover color :) x2

* Added hover style to containedPrimary msg btn

* Replace custom components for custom theme providers for Messages and Contacts apps

* Improve createAppThemeProvider

* Improve createAppThemeProvider

* Final housekeeping for messages styles

* Change placeholder to label in Contacts app text fields

* Fix alerts style with navigation and fix calc copy alerrt

* Split Phone code for snackbar

* Add more options and style Context Menu

* Enable Sellout theme provider and make it work with light themes
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-21 12:41:25 -05:00
1 parent 75e23b783c
commit 4acb214ec9
56 files changed
+738 -578

No files matched your search

+20 -6
View File
@@ -1,5 +1,7 @@
import { useEffect } from 'react';
import { useCallback, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { atom, useSetRecoilState, useRecoilValue } from 'recoil';
import Nui from '../../nui-events/utils/Nui';
const keyboardState = {
ArrowRight: atom({
@@ -45,6 +47,7 @@ const validKeys = [
const isKeyValid = (key) => validKeys.indexOf(key) !== -1;
export const useInitKeyboard = () => {
const history = useHistory();
const getters = {
ArrowRight: useRecoilValue(keyboardState.ArrowRight),
ArrowLeft: useRecoilValue(keyboardState.ArrowLeft),
@@ -56,6 +59,7 @@ export const useInitKeyboard = () => {
};
const setEscape = useSetRecoilState<any>(keyboardState.Escape);
const setBackspace = useSetRecoilState(keyboardState.Backspace);
useEffect(
function handleNUIKeyboardMessage() {
@@ -68,7 +72,7 @@ export const useInitKeyboard = () => {
callback.handler &&
callback.handler.call
) {
return callback.handler();
return callback.handler(event);
}
}
@@ -78,11 +82,22 @@ export const useInitKeyboard = () => {
[getters]
);
const escapeHandler = useCallback(() => Nui.send('phone:close'), []);
const backspaceHandler = useCallback((event) => {
if (['input', 'textarea'].includes(event.target.nodeName.toLowerCase())) {
// Dont anything if we are typing something :)
return;
}
history.goBack();
}, [history]);
useEffect(
function registerEscapeHandler() {
setEscape({ handler: () => console.log('close phone') });
function registerDefaultHandlers() {
setEscape({ handler: escapeHandler });
setBackspace({ handler: backspaceHandler });
},
[setEscape]
[setEscape, setBackspace, history, escapeHandler, backspaceHandler]
);
};
@@ -92,7 +107,6 @@ export const useKeyboard = () => {
ArrowLeft: useSetRecoilState(keyboardState.ArrowLeft),
ArrowUp: useSetRecoilState(keyboardState.ArrowUp),
ArrowDown: useSetRecoilState(keyboardState.ArrowDown),
Backspace: useSetRecoilState(keyboardState.Backspace),
Enter: useSetRecoilState(keyboardState.Enter),
};