mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 13:32:01 +00:00
further work on modal
This commit is contained in:
@@ -4,6 +4,7 @@ import { FaInfo, FaTimes } from 'react-icons/fa';
|
|||||||
|
|
||||||
import { Announcement, getAnnouncements } from '../store';
|
import { Announcement, getAnnouncements } from '../store';
|
||||||
import { useSetting } from '../utils/hooks/useSetting';
|
import { useSetting } from '../utils/hooks/useSetting';
|
||||||
|
import WithSuspense from './WithSuspense';
|
||||||
|
|
||||||
const SEVERITIES = {
|
const SEVERITIES = {
|
||||||
High: {
|
High: {
|
||||||
@@ -30,8 +31,8 @@ const welcomeAnnouncement: Announcement = {
|
|||||||
|
|
||||||
const welcomeAnnouncement2: Announcement = {
|
const welcomeAnnouncement2: Announcement = {
|
||||||
id: 'welcomeAnnouncement2',
|
id: 'welcomeAnnouncement2',
|
||||||
title: 'Welcome to Decky 2!',
|
title: 'Test With mkdown content and a slightly long title',
|
||||||
text: '',
|
text: '# Lorem Ipsum\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n\n## Features\n\n- **Bold text** for emphasis\n- *Italic text* for style\n- `Code snippets` for technical content\n\n### Getting Started\n\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\n> This is a blockquote with some important information.\n\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.',
|
||||||
created: Date.now().toString(),
|
created: Date.now().toString(),
|
||||||
updated: Date.now().toString(),
|
updated: Date.now().toString(),
|
||||||
};
|
};
|
||||||
@@ -82,7 +83,7 @@ export function AnnouncementsDisplay() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PanelSection>
|
<PanelSection>
|
||||||
<Focusable style={{display: "flex", flexDirection: "column", gap: "0.5rem"}}>
|
<Focusable style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
|
||||||
{currentlyDisplayingAnnouncements.map((announcement) => (
|
{currentlyDisplayingAnnouncements.map((announcement) => (
|
||||||
<Announcement
|
<Announcement
|
||||||
key={announcement.id}
|
key={announcement.id}
|
||||||
@@ -109,12 +110,12 @@ function Announcement({ announcement, onHide }: { announcement: Announcement; on
|
|||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
padding: '0.7rem',
|
padding: '0.7rem',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: "center",
|
alignItems: 'center',
|
||||||
justifyContent: "space-between"
|
justifyContent: 'space-between',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ fontWeight: 'bold' }}>{announcement.title}</span>
|
<span style={{ fontWeight: 'bold' }}>{announcement.title}</span>
|
||||||
<Focusable style={{display: "flex", alignItems: "center", gap: "0.5rem"}}>
|
<Focusable style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
||||||
<DialogButton
|
<DialogButton
|
||||||
style={{
|
style={{
|
||||||
width: '1rem',
|
width: '1rem',
|
||||||
@@ -178,7 +179,29 @@ function AnnouncementModal({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<ModalRoot>
|
<ModalRoot>
|
||||||
<span>{announcement.title}</span>
|
<style>
|
||||||
|
{`
|
||||||
|
.steam-focus {
|
||||||
|
outline-offset: 3px;
|
||||||
|
outline: 2px solid rgba(255, 255, 255, 0.6);
|
||||||
|
animation: pulseOutline 1.2s infinite ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulseOutline {
|
||||||
|
0% {
|
||||||
|
outline: 2px solid rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
outline: 2px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
outline: 2px solid rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<h1>{announcement.title}</h1>
|
||||||
|
<WithSuspense>
|
||||||
<MarkdownRenderer
|
<MarkdownRenderer
|
||||||
onDismiss={() => {
|
onDismiss={() => {
|
||||||
console.log('Dismiss');
|
console.log('Dismiss');
|
||||||
@@ -187,6 +210,11 @@ function AnnouncementModal({
|
|||||||
>
|
>
|
||||||
{announcement.text}
|
{announcement.text}
|
||||||
</MarkdownRenderer>
|
</MarkdownRenderer>
|
||||||
|
</WithSuspense>
|
||||||
|
<Focusable style={{ display: 'flex', gap: '0.5rem' }}>
|
||||||
|
<DialogButton onClick={() => onHide()}>Close Popup</DialogButton>
|
||||||
|
<DialogButton onClick={() => onHide()}>Close and Hide Announcement</DialogButton>
|
||||||
|
</Focusable>
|
||||||
</ModalRoot>
|
</ModalRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user