mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: fixing css issues
This commit is contained in:
parent
d5a3e3fae5
commit
24f58673cf
10 changed files with 41 additions and 1481 deletions
|
@ -28,13 +28,15 @@ export function SettingsBehavior() {
|
|||
useEffect(() => {
|
||||
if (userPreferences) {
|
||||
setForm({
|
||||
preferQuitInsteadOfHiding: userPreferences.preferQuitInsteadOfHiding,
|
||||
runAtStartup: userPreferences.runAtStartup,
|
||||
startMinimized: userPreferences.startMinimized,
|
||||
disableNsfwAlert: userPreferences.disableNsfwAlert,
|
||||
seedAfterDownloadComplete: userPreferences.seedAfterDownloadComplete,
|
||||
preferQuitInsteadOfHiding:
|
||||
userPreferences.preferQuitInsteadOfHiding ?? false,
|
||||
runAtStartup: userPreferences.runAtStartup ?? false,
|
||||
startMinimized: userPreferences.startMinimized ?? false,
|
||||
disableNsfwAlert: userPreferences.disableNsfwAlert ?? false,
|
||||
seedAfterDownloadComplete:
|
||||
userPreferences.seedAfterDownloadComplete ?? false,
|
||||
showHiddenAchievementsDescription:
|
||||
userPreferences.showHiddenAchievementsDescription,
|
||||
userPreferences.showHiddenAchievementsDescription ?? false,
|
||||
});
|
||||
}
|
||||
}, [userPreferences]);
|
||||
|
|
|
@ -65,18 +65,20 @@ export function SettingsGeneral() {
|
|||
(language) => language === userPreferences.language
|
||||
) ??
|
||||
languageKeys.find((language) => {
|
||||
return language.startsWith(userPreferences.language.split("-")[0]);
|
||||
return language.startsWith(
|
||||
userPreferences.language?.split("-")[0] ?? "en"
|
||||
);
|
||||
});
|
||||
|
||||
setForm((prev) => ({
|
||||
...prev,
|
||||
downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath,
|
||||
downloadNotificationsEnabled:
|
||||
userPreferences.downloadNotificationsEnabled,
|
||||
userPreferences.downloadNotificationsEnabled ?? false,
|
||||
repackUpdatesNotificationsEnabled:
|
||||
userPreferences.repackUpdatesNotificationsEnabled,
|
||||
userPreferences.repackUpdatesNotificationsEnabled ?? false,
|
||||
achievementNotificationsEnabled:
|
||||
userPreferences.achievementNotificationsEnabled,
|
||||
userPreferences.achievementNotificationsEnabled ?? false,
|
||||
language: language ?? "en",
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { Button } from "@renderer/components";
|
||||
|
||||
const meta = {
|
||||
title: "Components/Button",
|
||||
component: Button,
|
||||
parameters: {
|
||||
layout: "centered",
|
||||
},
|
||||
tags: ["autodocs"],
|
||||
} satisfies Meta<typeof Button>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof Button>;
|
||||
|
||||
// Primary button (default)
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
children: "Primary Button",
|
||||
theme: "primary",
|
||||
},
|
||||
};
|
||||
|
||||
// Outline variant
|
||||
export const Outline: Story = {
|
||||
args: {
|
||||
children: "Outline Button",
|
||||
theme: "outline",
|
||||
},
|
||||
};
|
||||
|
||||
// Dark variant
|
||||
export const Dark: Story = {
|
||||
args: {
|
||||
children: "Dark Button",
|
||||
theme: "dark",
|
||||
},
|
||||
};
|
||||
|
||||
// Danger variant
|
||||
export const Danger: Story = {
|
||||
args: {
|
||||
children: "Danger Button",
|
||||
theme: "danger",
|
||||
},
|
||||
};
|
||||
|
||||
// Disabled state
|
||||
export const Disabled: Story = {
|
||||
args: {
|
||||
children: "Disabled Button",
|
||||
disabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
// Button with icon example
|
||||
export const WithIcon: Story = {
|
||||
args: {
|
||||
children: (
|
||||
<>
|
||||
<span>🚀</span>
|
||||
<span>Button with Icon</span>
|
||||
</>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
// Different sizes example using className
|
||||
export const CustomClassName: Story = {
|
||||
args: {
|
||||
children: "Custom Class Button",
|
||||
className: "custom-class",
|
||||
},
|
||||
};
|
|
@ -1,115 +0,0 @@
|
|||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { Toast } from "@renderer/components";
|
||||
import { useState } from "react";
|
||||
|
||||
const meta = {
|
||||
title: "Components/Toast",
|
||||
component: Toast,
|
||||
parameters: {
|
||||
layout: "centered",
|
||||
},
|
||||
tags: ["autodocs"],
|
||||
} satisfies Meta<typeof Toast>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof Toast>;
|
||||
|
||||
// Base stories for each variant
|
||||
export const Success: Story = {
|
||||
args: {
|
||||
visible: true,
|
||||
message: "Operation completed successfully",
|
||||
type: "success",
|
||||
onClose: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
export const Error: Story = {
|
||||
args: {
|
||||
visible: true,
|
||||
message: "An error occurred",
|
||||
type: "error",
|
||||
onClose: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
export const Warning: Story = {
|
||||
args: {
|
||||
visible: true,
|
||||
message: "Please review before proceeding",
|
||||
type: "warning",
|
||||
onClose: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
// Interactive story with toggle functionality
|
||||
const InteractiveToastTemplate = () => {
|
||||
const [visible, setVisible] = useState(true);
|
||||
|
||||
return (
|
||||
<div style={{ padding: "20px" }}>
|
||||
<button onClick={() => setVisible(true)} style={{ marginBottom: "20px" }}>
|
||||
Show Toast
|
||||
</button>
|
||||
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
bottom: "16px",
|
||||
right: "16px",
|
||||
maxWidth: "420px",
|
||||
width: "420px",
|
||||
}}
|
||||
>
|
||||
<Toast
|
||||
visible={visible}
|
||||
message="This is an interactive toast"
|
||||
type="success"
|
||||
onClose={() => setVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const Interactive: Story = {
|
||||
render: () => <InteractiveToastTemplate />,
|
||||
};
|
||||
|
||||
// Long message example
|
||||
export const LongMessage: Story = {
|
||||
args: {
|
||||
visible: true,
|
||||
message:
|
||||
"This is a very long message that demonstrates how the toast component handles text wrapping and content overflow in cases where the message is extensive",
|
||||
type: "success",
|
||||
onClose: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
// Story with auto-close behavior
|
||||
const AutoCloseToastTemplate = () => {
|
||||
const [visible, setVisible] = useState(true);
|
||||
|
||||
return (
|
||||
<div style={{ padding: "20px" }}>
|
||||
<button
|
||||
onClick={() => setVisible(true)}
|
||||
style={{ marginBottom: "20px" }}
|
||||
disabled={visible}
|
||||
>
|
||||
Show Toast Again
|
||||
</button>
|
||||
<Toast
|
||||
visible={visible}
|
||||
message="This toast will auto-close in 2.5 seconds"
|
||||
type="success"
|
||||
onClose={() => setVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const AutoClose: Story = {
|
||||
render: () => <AutoCloseToastTemplate />,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue