diff --git a/apps/frontend/src/assets/styles/components.scss b/apps/frontend/src/assets/styles/components.scss index 357e33a3c1..21a5ccbf3d 100644 --- a/apps/frontend/src/assets/styles/components.scss +++ b/apps/frontend/src/assets/styles/components.scss @@ -223,10 +223,7 @@ :where(input) { box-sizing: border-box; max-height: 40px; - - &:not(.stylized-toggle) { - max-width: 100%; - } + max-width: 100%; } :where(.adjacent-input, &.adjacent-input) { @@ -271,10 +268,6 @@ &:not(&.small) { flex-direction: column; align-items: flex-start; - - .stylized-toggle { - flex-basis: 0; - } } } } @@ -650,64 +643,6 @@ tr.button-transparent { } } -.switch { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - -webkit-tap-highlight-color: transparent; - cursor: pointer; - - &:focus { - //outline: 0; Bad for accessibility - } -} - -.stylized-toggle { - @extend .button-base; - - box-sizing: content-box; - min-height: 32px; - height: 32px; - width: 52px; - max-width: 52px; - border-radius: var(--size-rounded-max); - display: inline-block; - position: relative; - margin: 0; - transition: all 0.2s ease; - background: var(--color-button-bg); - - &:after { - content: ''; - position: absolute; - top: 7px; - left: 7px; - width: 18px; - height: 18px; - border-radius: 50%; - background: var(--color-toggle-handle); - transition: all 0.2s cubic-bezier(0.5, 0.1, 0.75, 1.35); - outline: 2px solid transparent; - - @media (prefers-reduced-motion) { - transition: none; - } - } - - &:checked { - background-color: var(--color-brand); - - &:after { - transform: translatex(20px); - background: var(--color-brand-inverted); - } - } - - &:hover &:focus { - background: var(--color-button-bg); - } -} - .textarea-wrapper { display: flex; flex-direction: column; diff --git a/apps/frontend/src/assets/styles/global.scss b/apps/frontend/src/assets/styles/global.scss index 51c554d8d7..a01337a9a4 100644 --- a/apps/frontend/src/assets/styles/global.scss +++ b/apps/frontend/src/assets/styles/global.scss @@ -60,8 +60,6 @@ html { --color-button-bg-active: #c3c6cb; --color-button-text-active: var(--color-button-text-hover); - --color-toggle-handle: var(--color-icon); - --color-dropdown-bg: var(--color-button-bg); --color-dropdown-text: var(--color-button-text); @@ -177,8 +175,6 @@ html { --color-button-bg-active: #616570; --color-button-text-active: var(--color-button-text-hover); - --color-toggle-handle: var(--color-button-text); - --color-dropdown-bg: var(--color-button-bg); --color-dropdown-text: var(--color-button-text); diff --git a/apps/frontend/src/components/ui/servers/PlatformChangeModpackVersionModal.vue b/apps/frontend/src/components/ui/servers/PlatformChangeModpackVersionModal.vue index 0b31fce762..2c9072a731 100644 --- a/apps/frontend/src/components/ui/servers/PlatformChangeModpackVersionModal.vue +++ b/apps/frontend/src/components/ui/servers/PlatformChangeModpackVersionModal.vue @@ -32,12 +32,7 @@ - +
If enabled, existing mods, worlds, and configurations, will be deleted before installing @@ -69,7 +64,7 @@ - - diff --git a/apps/frontend/src/components/ui/servers/PlatformMrpackModal.vue b/apps/frontend/src/components/ui/servers/PlatformMrpackModal.vue index 436b938f80..d3d76f60f6 100644 --- a/apps/frontend/src/components/ui/servers/PlatformMrpackModal.vue +++ b/apps/frontend/src/components/ui/servers/PlatformMrpackModal.vue @@ -53,12 +53,7 @@ - +
Removes all data on your server, including your worlds, mods, and configuration @@ -128,6 +123,7 @@ import { ButtonStyled, injectNotificationManager, NewModal, + Toggle, } from '@modrinth/ui' import { ModrinthServersFetchError } from '@modrinth/utils' import { onMounted, onUnmounted } from 'vue' @@ -255,9 +251,3 @@ const hide = () => mrpackModal.value?.hide() defineExpose({ show, hide }) - - diff --git a/apps/frontend/src/components/ui/servers/PlatformVersionSelectModal.vue b/apps/frontend/src/components/ui/servers/PlatformVersionSelectModal.vue index 71b5609f89..c465180bb2 100644 --- a/apps/frontend/src/components/ui/servers/PlatformVersionSelectModal.vue +++ b/apps/frontend/src/components/ui/servers/PlatformVersionSelectModal.vue @@ -143,12 +143,7 @@ - +
Removes all data on your server, including your worlds, mods, and configuration files, @@ -542,9 +537,3 @@ const hide = () => versionSelectModal.value?.hide() defineExpose({ show, hide }) - - diff --git a/apps/frontend/src/components/ui/servers/ServerInstallation.vue b/apps/frontend/src/components/ui/servers/ServerInstallation.vue index 56ac895f4d..88a7db3ffe 100644 --- a/apps/frontend/src/components/ui/servers/ServerInstallation.vue +++ b/apps/frontend/src/components/ui/servers/ServerInstallation.vue @@ -274,10 +274,6 @@ watch( diff --git a/apps/frontend/src/pages/flags.vue b/apps/frontend/src/pages/flags.vue index 8c7376c253..18536bc08a 100644 --- a/apps/frontend/src/pages/flags.vue +++ b/apps/frontend/src/pages/flags.vue @@ -1,67 +1,76 @@ - - diff --git a/apps/frontend/src/pages/hosting/manage/[id]/content/index.vue b/apps/frontend/src/pages/hosting/manage/[id]/content/index.vue index f4bdc02862..c773d69686 100644 --- a/apps/frontend/src/pages/hosting/manage/[id]/content/index.vue +++ b/apps/frontend/src/pages/hosting/manage/[id]/content/index.vue @@ -242,13 +242,11 @@ >
- @@ -353,7 +351,13 @@ import { TrashIcon, WrenchIcon, } from '@modrinth/assets' -import { Avatar, ButtonStyled, injectModrinthClient, injectNotificationManager } from '@modrinth/ui' +import { + Avatar, + ButtonStyled, + injectModrinthClient, + injectNotificationManager, + Toggle, +} from '@modrinth/ui' import type { Mod } from '@modrinth/utils' import { computed, onMounted, onUnmounted, ref, watch } from 'vue' @@ -699,8 +703,4 @@ const filteredMods = computed(() => { height: 1px; visibility: hidden; } - -.stylized-toggle:checked::after { - background: var(--color-accent-contrast) !important; -} diff --git a/apps/frontend/src/pages/hosting/manage/[id]/options/preferences.vue b/apps/frontend/src/pages/hosting/manage/[id]/options/preferences.vue index bb81742597..4102a6b5c7 100644 --- a/apps/frontend/src/pages/hosting/manage/[id]/options/preferences.vue +++ b/apps/frontend/src/pages/hosting/manage/[id]/options/preferences.vue @@ -21,11 +21,10 @@ {{ prefConfig.description }} - @@ -42,7 +41,7 @@ - - diff --git a/apps/frontend/src/pages/hosting/manage/[id]/options/properties.vue b/apps/frontend/src/pages/hosting/manage/[id]/options/properties.vue index 73f552282a..16c57e7ace 100644 --- a/apps/frontend/src/pages/hosting/manage/[id]/options/properties.vue +++ b/apps/frontend/src/pages/hosting/manage/[id]/options/properties.vue @@ -62,11 +62,9 @@ />
-
@@ -134,7 +132,7 @@ - - diff --git a/apps/frontend/src/pages/hosting/manage/[id]/options/startup.vue b/apps/frontend/src/pages/hosting/manage/[id]/options/startup.vue index c9699c2f28..50ff0fb78b 100644 --- a/apps/frontend/src/pages/hosting/manage/[id]/options/startup.vue +++ b/apps/frontend/src/pages/hosting/manage/[id]/options/startup.vue @@ -69,12 +69,7 @@
- +
import { IssuesIcon, UpdatedIcon } from '@modrinth/assets' -import { ButtonStyled, Combobox, injectNotificationManager } from '@modrinth/ui' +import { ButtonStyled, Combobox, injectNotificationManager, Toggle } from '@modrinth/ui' import SaveBanner from '~/components/ui/servers/SaveBanner.vue' import type { ModrinthServer } from '~/composables/servers/modrinth-servers.ts' @@ -232,9 +227,3 @@ function resetToDefault() { invocation.value = originalInvocation.value ?? '' } - - diff --git a/apps/frontend/src/pages/settings/index.vue b/apps/frontend/src/pages/settings/index.vue index ad93ccbec6..a737dbc3bc 100644 --- a/apps/frontend/src/pages/settings/index.vue +++ b/apps/frontend/src/pages/settings/index.vue @@ -119,85 +119,78 @@

{{ formatMessage(toggleFeatures.title) }}

{{ formatMessage(toggleFeatures.description) }}

-
- - -
-
- - -
-
- - -
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
@@ -212,6 +205,7 @@ import { IntlFormatted, normalizeChildren, ThemeSelector, + Toggle, useVIntl, } from '@modrinth/ui' import { formatProjectType } from '@modrinth/utils' diff --git a/packages/assets/styles/classes.scss b/packages/assets/styles/classes.scss index d4d6a72c0a..a0d62bf970 100644 --- a/packages/assets/styles/classes.scss +++ b/packages/assets/styles/classes.scss @@ -70,10 +70,7 @@ :where(input) { box-sizing: border-box; max-height: 40px; - - &:not(.stylized-toggle) { - max-width: 100%; - } + max-width: 100%; } :where(.adjacent-input, &.adjacent-input) { @@ -118,10 +115,6 @@ &:not(&.small) { flex-direction: column; align-items: start; - - .stylized-toggle { - flex-basis: 0; - } } } } @@ -766,60 +759,6 @@ a, } } -.switch { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - -webkit-tap-highlight-color: transparent; - cursor: pointer; -} - -.stylized-toggle { - @extend .button-base; - - box-sizing: content-box; - min-height: 32px; - height: 32px; - min-width: 52px; - max-width: 52px; - border-radius: var(--radius-max); - display: inline-block; - position: relative; - margin: 0; - transition: all 0.2s ease; - background: var(--color-button-bg); - - &:after { - content: ''; - position: absolute; - top: 7px; - left: 7px; - width: 18px; - height: 18px; - border-radius: 50%; - background: var(--color-gray); - transition: all 0.2s cubic-bezier(0.5, 0.1, 0.75, 1.35); - outline: 2px solid transparent; - - @media (prefers-reduced-motion) { - transition: none; - } - } - - &:checked { - background-color: var(--color-brand); - - &:after { - transform: translatex(20px); - background: var(--color-accent-contrast); - } - } - - &:hover &:focus { - background: var(--color-button-bg); - } -} - // TOOLTIPS .v-popper--theme-dropdown, diff --git a/packages/tooling-config/tailwind/tailwind-preset.ts b/packages/tooling-config/tailwind/tailwind-preset.ts index 3c6ca2a69e..e566b3f8ac 100644 --- a/packages/tooling-config/tailwind/tailwind-preset.ts +++ b/packages/tooling-config/tailwind/tailwind-preset.ts @@ -224,7 +224,7 @@ const config: Config = { hr: 'var(--color-hr)', table: { border: 'var(--color-table-border)', - alternateRow: ' var(--color-table-alternate-row)', + alternateRow: 'var(--color-table-alternate-row)', }, }, backgroundImage: { diff --git a/packages/ui/.storybook/preview.ts b/packages/ui/.storybook/preview.ts index 2c3f329bcb..53ae7e64c1 100644 --- a/packages/ui/.storybook/preview.ts +++ b/packages/ui/.storybook/preview.ts @@ -2,6 +2,7 @@ import '@modrinth/assets/omorphia.scss' import 'floating-vue/dist/style.css' import '../src/styles/tailwind.css' +import { GenericModrinthClient } from '@modrinth/api-client' import { withThemeByClassName } from '@storybook/addon-themes' import type { Preview } from '@storybook/vue3-vite' import { setup } from '@storybook/vue3-vite' @@ -17,7 +18,10 @@ import { } from '../src/composables/i18n' import { AbstractWebNotificationManager, + I18N_INJECTION_KEY, + type I18nContext, type NotificationPanelLocation, + provideModrinthClient, provideNotificationManager, type WebNotification, } from '../src/providers' @@ -77,6 +81,17 @@ class StorybookNotificationManager extends AbstractWebNotificationManager { setup((app) => { app.use(i18n) + + // Provide the custom I18nContext for components using injectI18n() + const i18nContext: I18nContext = { + locale: i18n.global.locale, + t: (key, values) => i18n.global.t(key, values ?? {}) as string, + setLocale: (newLocale) => { + i18n.global.locale.value = newLocale + }, + } + app.provide(I18N_INJECTION_KEY, i18nContext) + app.use(FloatingVue, { themes: { 'ribbit-popout': { @@ -100,10 +115,15 @@ setup((app) => { } }) -// Wrapper component that provides notification manager context -const NotificationManagerProvider = defineComponent({ +const StorybookProvider = defineComponent({ setup(_, { slots }) { provideNotificationManager(new StorybookNotificationManager()) + + const modrinthClient = new GenericModrinthClient({ + userAgent: 'modrinth-storybook/1.0.0', + }) + provideModrinthClient(modrinthClient) + return () => slots.default?.() }, }) @@ -126,14 +146,13 @@ const preview: Preview = { }, defaultTheme: 'dark', }), - // Wrap stories with notification manager provider (story) => ({ - components: { story, NotificationManagerProvider, NotificationPanel }, + components: { story, StorybookProvider, NotificationPanel }, template: /*html*/ ` - + - + `, }), ], diff --git a/packages/ui/src/components/base/Avatar.vue b/packages/ui/src/components/base/Avatar.vue index 06c42f8775..90a2bd40e6 100644 --- a/packages/ui/src/components/base/Avatar.vue +++ b/packages/ui/src/components/base/Avatar.vue @@ -1,6 +1,6 @@