pl-fe: just a shitpost
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -2,6 +2,8 @@ import clsx from 'clsx';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
import { useOwnAccount } from 'pl-fe/hooks/use-own-account';
|
||||||
|
|
||||||
import Button from './button';
|
import Button from './button';
|
||||||
import { ButtonThemes } from './button/useButtonStyles';
|
import { ButtonThemes } from './button/useButtonStyles';
|
||||||
import IconButton from './icon-button';
|
import IconButton from './icon-button';
|
||||||
@ -12,6 +14,16 @@ const messages = defineMessages({
|
|||||||
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
|
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const useDefaultCloseIcon = (): string => {
|
||||||
|
const { account } = useOwnAccount();
|
||||||
|
|
||||||
|
if (account?.ap_id === 'https://donotsta.re/users/pmysl' || account?.ap_id === 'https://to.juz.sie.federu.je/users/pmysl') {
|
||||||
|
return require('@phosphor-icons/core/regular/twitter-logo.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
return require('@phosphor-icons/core/regular/x.svg');
|
||||||
|
};
|
||||||
|
|
||||||
interface IModal {
|
interface IModal {
|
||||||
/** Callback when the modal is cancelled. */
|
/** Callback when the modal is cancelled. */
|
||||||
cancelAction?: () => void;
|
cancelAction?: () => void;
|
||||||
@ -50,7 +62,7 @@ const Modal = React.forwardRef<HTMLDivElement, IModal>(({
|
|||||||
cancelAction,
|
cancelAction,
|
||||||
cancelText,
|
cancelText,
|
||||||
children,
|
children,
|
||||||
closeIcon = require('@phosphor-icons/core/regular/x.svg'),
|
closeIcon,
|
||||||
closePosition = 'right',
|
closePosition = 'right',
|
||||||
confirmationAction,
|
confirmationAction,
|
||||||
confirmationDisabled,
|
confirmationDisabled,
|
||||||
@ -69,6 +81,10 @@ const Modal = React.forwardRef<HTMLDivElement, IModal>(({
|
|||||||
const buttonRef = React.useRef<HTMLButtonElement>(null);
|
const buttonRef = React.useRef<HTMLButtonElement>(null);
|
||||||
const [firstRender, setFirstRender] = React.useState(true);
|
const [firstRender, setFirstRender] = React.useState(true);
|
||||||
|
|
||||||
|
const defaultCloseIcon = useDefaultCloseIcon();
|
||||||
|
|
||||||
|
closeIcon = closeIcon || defaultCloseIcon;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setFirstRender(false);
|
setFirstRender(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user