Skip to content

Commit

Permalink
Merge pull request #79 from edsonmartins/fix-dialog
Browse files Browse the repository at this point in the history
fix: ajustar dialog para aceitar outros valores além de string
  • Loading branch information
edsonmartins authored Jun 19, 2024
2 parents 1bb87b1 + f1544dd commit cbef035
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/notification/ArchbaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
IconTriangle,
} from '@tabler/icons-react';
import i18next from 'i18next';
import React, { ChangeEventHandler } from 'react';
import React, { ChangeEventHandler, ReactNode } from 'react';

export class ArchbaseDialog {
static showConfirmDialogYesNo = (title: string, question: string, onConfirm: () => void, onCancel: () => void) => {
Expand All @@ -26,14 +26,14 @@ export class ArchbaseDialog {
});
};

static showInfo = (message: string, title?: string, onConfirm?: () => void) => {
static showInfo = (message: ReactNode, title?: string, onConfirm?: () => void) => {
modals.open({
title: title || i18next.t('archbase:Information'),
children: (
<Paper>
<Flex gap="md" direction="row" justify="flex-start" align="center">
<IconInfoCircleFilled size="2rem" style={{ color: '#099CFF' }} />
<Text size="md">{message}</Text>
{ typeof message === "string" ? <Text size="md">{message}</Text> : message }
</Flex>
<Button
fullWidth
Expand All @@ -50,14 +50,14 @@ export class ArchbaseDialog {
});
};

static showWarning = (message: string, title?: string, onConfirm?: () => void) => {
static showWarning = (message: ReactNode, title?: string, onConfirm?: () => void) => {
modals.open({
title: title || i18next.t('archbase:Attention'),
children: (
<Paper>
<Flex gap="md" direction="row" justify="flex-start" align="center">
<IconAlertTriangleFilled size="2rem" style={{ color: 'orange' }} />
<Text size="md">{message}</Text>
{ typeof message === "string" ? <Text size="md">{message}</Text> : message }
</Flex>
<Button
fullWidth
Expand All @@ -74,14 +74,14 @@ export class ArchbaseDialog {
});
};

static showSuccess = (message: string, title?: string, onConfirm?: () => void) => {
static showSuccess = (message: ReactNode, title?: string, onConfirm?: () => void) => {
modals.open({
title: title || i18next.t('archbase:Attention'),
children: (
<Paper>
<Flex gap="md" direction="row" justify="flex-start" align="center">
<IconCircleCheckFilled size="2rem" style={{ color: '#1AC455' }} />
<Text size="md">{message}</Text>
{ typeof message === "string" ? <Text size="md">{message}</Text> : message }
</Flex>
<Button
fullWidth
Expand All @@ -98,15 +98,15 @@ export class ArchbaseDialog {
});
};

static showError = (message: string, title?: string, onConfirm?: () => void) => {
static showError = (message: ReactNode, title?: string, onConfirm?: () => void) => {
modals.open({
title: title || i18next.t('archbase:Attention'),
size: 'md',
children: (
<Paper>
<Flex gap="md" direction="row" justify="flex-start" align="center">
<IconBug size="96px" style={{ color: 'red' }} />
<Text size="md">{message}</Text>
{ typeof message === "string" ? <Text size="md">{message}</Text> : message }
</Flex>
<Button
fullWidth
Expand Down Expand Up @@ -176,7 +176,7 @@ export const CustomShowErrorModal = ({
context,
id,
innerProps,
}: ContextModalProps<{ message: string; detailMessage?: string; onConfirm?: () => void }>) => (
}: ContextModalProps<{ message: ReactNode; detailMessage?: ReactNode; onConfirm?: () => void }>) => (
<Paper miw={'400px'}>
<Accordion variant="contained">
<Accordion.Item value="photos">
Expand Down

0 comments on commit cbef035

Please sign in to comment.