refactor(web/alert): use primary color theme for the button color

This commit is contained in:
Luke
2022-12-18 12:07:37 +01:00
parent e7d86af637
commit 50aab9987c

View File

@@ -1,4 +1,4 @@
import { Modal, Button, Stack, Group } from '@mantine/core'; import { Modal, Button, Stack, Group, useMantineTheme } from '@mantine/core';
import { useState } from 'react'; import { useState } from 'react';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import { useNuiEvent } from '../../hooks/useNuiEvent'; import { useNuiEvent } from '../../hooks/useNuiEvent';
@@ -18,6 +18,7 @@ export interface AlertProps {
const AlertDialog: React.FC = () => { const AlertDialog: React.FC = () => {
const { locale } = useLocales(); const { locale } = useLocales();
const theme = useMantineTheme();
const [opened, setOpened] = useState(false); const [opened, setOpened] = useState(false);
const [dialogData, setDialogData] = useState<AlertProps>({ const [dialogData, setDialogData] = useState<AlertProps>({
header: '', header: '',
@@ -63,8 +64,8 @@ const AlertDialog: React.FC = () => {
)} )}
<Button <Button
uppercase uppercase
variant="light" variant={dialogData.cancel ? 'light' : 'default'}
color={dialogData.cancel ? 'blue' : undefined} color={dialogData.cancel ? theme.primaryColor : undefined}
onClick={() => closeAlert('confirm')} onClick={() => closeAlert('confirm')}
> >
{dialogData.labels?.confirm || locale.ui.confirm} {dialogData.labels?.confirm || locale.ui.confirm}