mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(web): ability to align icon at the top for notifs/text ui
This commit is contained in:
@@ -22,6 +22,7 @@ interface NotifyProps {
|
|||||||
style?: Sx;
|
style?: Sx;
|
||||||
icon?: IconName | [IconPrefix, IconName];
|
icon?: IconName | [IconPrefix, IconName];
|
||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
|
alignIcon?: 'top' | 'center';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const notify = (data: NotifyProps): void => exports.ox_lib.notify(data);
|
export const notify = (data: NotifyProps): void => exports.ox_lib.notify(data);
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ interface OptionsProps {
|
|||||||
icon?: IconName | [IconPrefix, IconName];
|
icon?: IconName | [IconPrefix, IconName];
|
||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
|
alignIcon?: 'top' | 'center';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const showTextUI = (text: string, options?: OptionsProps): void => exports.ox_lib.showTextUI(text, options);
|
export const showTextUI = (text: string, options?: OptionsProps): void => exports.ox_lib.showTextUI(text, options);
|
||||||
|
|
||||||
export const hideTextUI = (): void => exports.ox_lib.hideTextUI();
|
export const hideTextUI = (): void => exports.ox_lib.hideTextUI();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
---@field style? { [string]: any }
|
---@field style? { [string]: any }
|
||||||
---@field icon? string | {[1]: IconProp, [2]: string};
|
---@field icon? string | {[1]: IconProp, [2]: string};
|
||||||
---@field iconColor? string;
|
---@field iconColor? string;
|
||||||
|
---@field alignIcon? 'top' | 'center';
|
||||||
|
|
||||||
---`client`
|
---`client`
|
||||||
---@param data NotifyProps
|
---@param data NotifyProps
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
---@field icon? string | {[1]: IconProp, [2]: string};
|
---@field icon? string | {[1]: IconProp, [2]: string};
|
||||||
---@field iconColor? string;
|
---@field iconColor? string;
|
||||||
---@field style? string | table;
|
---@field style? string | table;
|
||||||
|
---@field alignIcon? 'top' | 'center';
|
||||||
|
|
||||||
local isOpen = false
|
local isOpen = false
|
||||||
local currentText
|
local currentText
|
||||||
|
|||||||
@@ -169,13 +169,22 @@ const Notifications: React.FC = () => {
|
|||||||
? 'yellow'
|
? 'yellow'
|
||||||
: 'blue'
|
: 'blue'
|
||||||
}
|
}
|
||||||
|
style={{ alignSelf: !data.alignIcon || data.alignIcon === 'center' ? 'center' : 'start' }}
|
||||||
radius="xl"
|
radius="xl"
|
||||||
size={32}
|
size={32}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={data.icon} fixedWidth size="lg" />
|
<FontAwesomeIcon icon={data.icon} fixedWidth size="lg" />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
) : (
|
) : (
|
||||||
<FontAwesomeIcon icon={data.icon} style={{ color: data.iconColor }} fixedWidth size="lg" />
|
<FontAwesomeIcon
|
||||||
|
icon={data.icon}
|
||||||
|
style={{
|
||||||
|
color: data.iconColor,
|
||||||
|
alignSelf: !data.alignIcon || data.alignIcon === 'center' ? 'center' : 'start',
|
||||||
|
}}
|
||||||
|
fixedWidth
|
||||||
|
size="lg"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -52,7 +52,17 @@ const TextUI: React.FC = () => {
|
|||||||
<ScaleFade visible={visible}>
|
<ScaleFade visible={visible}>
|
||||||
<Box style={data.style} className={classes.container}>
|
<Box style={data.style} className={classes.container}>
|
||||||
<Group spacing={12}>
|
<Group spacing={12}>
|
||||||
{data.icon && <FontAwesomeIcon icon={data.icon} fixedWidth size="lg" style={{ color: data.iconColor }} />}
|
{data.icon && (
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={data.icon}
|
||||||
|
fixedWidth
|
||||||
|
size="lg"
|
||||||
|
style={{
|
||||||
|
color: data.iconColor,
|
||||||
|
alignSelf: !data.alignIcon || data.alignIcon === 'center' ? 'center' : 'start',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm]}>
|
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm]}>
|
||||||
{data.text}
|
{data.text}
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ export interface NotificationProps {
|
|||||||
position?: ToastPosition | 'top' | 'bottom';
|
position?: ToastPosition | 'top' | 'bottom';
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
type?: string;
|
type?: string;
|
||||||
|
alignIcon?: 'top' | 'center';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ export interface TextUiProps {
|
|||||||
icon?: IconProp;
|
icon?: IconProp;
|
||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
alignIcon?: 'top' | 'center';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user