1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-06 10:06:41 +07:00

added more toasts

This commit is contained in:
Fedor Katurov 2022-01-04 21:22:44 +07:00
parent 39e801f6f3
commit e24ea4afeb
5 changed files with 56 additions and 21 deletions
src/constants

View file

@ -1,6 +1,8 @@
import { useMemo } from 'react';
export const PHRASES = {
WELCOME: ['Ого! Кто это тут у нас?'],
GOODBYE: ['Возвращайся, мы будем скучать'],
SIMPLE: [
'Ответ на твоё одиночество кроется в одиночестве. Удивительно? Нет.',
'Ах, Боря, Боренька, неужели это всё, на что мы с тобою способны?',
@ -63,5 +65,8 @@ export const PHRASES = {
],
};
export const getRandomPhrase = (key: keyof typeof PHRASES) =>
PHRASES[key][Math.floor(Math.random() * PHRASES[key].length)];
export const useRandomPhrase = (key: keyof typeof PHRASES) =>
useMemo(() => PHRASES[key][Math.floor(Math.random() * PHRASES[key].length)], [key]);
useMemo(() => getRandomPhrase(key), [key]);