From d5162c4b757f2381ab8f2ee31468ea8f02db67ef Mon Sep 17 00:00:00 2001 From: Svyatoslav Kryukov Date: Thu, 24 Oct 2024 17:54:28 +0300 Subject: [PATCH] run prettier --- docs/.vitepress/config.mts | 185 +++++++++++++----------- docs/.vitepress/theme/frameworksTabs.ts | 24 +-- docs/.vitepress/theme/index.ts | 22 +-- docs/.vitepress/theme/style.css | 18 +-- 4 files changed, 130 insertions(+), 119 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 1ed0178..170800b 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,11 +1,10 @@ -import {defineConfig} from 'vitepress' -import {tabsMarkdownPlugin} from 'vitepress-plugin-tabs' +import { defineConfig } from "vitepress"; +import { tabsMarkdownPlugin } from "vitepress-plugin-tabs"; - -const title = 'Inertia Rails' -const description = 'Community documentation for Inertia.js Rails adapter' -const site = 'https://inertia-rails.netlify.app' -const image = `${site}/og_image.jpg` +const title = "Inertia Rails"; +const description = "Community documentation for Inertia.js Rails adapter"; +const site = "https://inertia-rails.netlify.app"; +const image = `${site}/og_image.jpg`; // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -14,114 +13,125 @@ export default defineConfig({ markdown: { config(md) { - md.use(tabsMarkdownPlugin) - } + md.use(tabsMarkdownPlugin); + }, }, head: [ - ['link', {rel: 'icon', href: '/favicon.ico', sizes: "32x32"}], - ['link', {rel: 'icon', href: '/icon.svg', type: 'image/svg+xml'}], + ["link", { rel: "icon", href: "/favicon.ico", sizes: "32x32" }], + ["link", { rel: "icon", href: "/icon.svg", type: "image/svg+xml" }], - ['meta', {name: 'twitter:card', content: 'summary_large_image'}], - ['meta', {name: 'twitter:site', content: site}], - ['meta', {name: 'twitter:description', value: description}], - ['meta', {name: 'twitter:image', content: image}], + ["meta", { name: "twitter:card", content: "summary_large_image" }], + ["meta", { name: "twitter:site", content: site }], + ["meta", { name: "twitter:description", value: description }], + ["meta", { name: "twitter:image", content: image }], - ['meta', {property: 'og:type', content: 'website'}], - ['meta', {property: 'og:locale', content: 'en_US'}], - ['meta', {property: 'og:site', content: site}], - ['meta', {property: 'og:site_name', content: title}], - ['meta', {property: 'og:image', content: image}], - ['meta', {property: 'og:description', content: description}], + ["meta", { property: "og:type", content: "website" }], + ["meta", { property: "og:locale", content: "en_US" }], + ["meta", { property: "og:site", content: site }], + ["meta", { property: "og:site_name", content: title }], + ["meta", { property: "og:image", content: image }], + ["meta", { property: "og:description", content: description }], ], themeConfig: { // https://vitepress.dev/reference/default-theme-config nav: [ - {text: 'Home', link: '/'}, - {text: 'Guide', link: '/guide'}, - {text: 'Cookbook', link: '/cookbook/integrating-shadcn-ui'}, + { text: "Home", link: "/" }, + { text: "Guide", link: "/guide" }, + { text: "Cookbook", link: "/cookbook/integrating-shadcn-ui" }, { - text: 'Links', items: [ - {text: 'Official Inertia.js docs', link: 'https://inertiajs.com'}, + text: "Links", + items: [ + { text: "Official Inertia.js docs", link: "https://inertiajs.com" }, { - text: 'Gems', items: [ - {text: 'inertia_rails', link: 'https://github.com/inertiajs/inertia-rails'}, - {text: 'inertia_rails-contrib', link: 'https://github.com/skryukov/inertia_rails-contrib'}, - ] + text: "Gems", + items: [ + { + text: "inertia_rails", + link: "https://github.com/inertiajs/inertia-rails", + }, + { + text: "inertia_rails-contrib", + link: "https://github.com/skryukov/inertia_rails-contrib", + }, + ], }, - ] - } + ], + }, ], - logo: '/logo.svg', + logo: "/logo.svg", sidebar: { - '/guide': [ + "/guide": [ { items: [ - {text: 'Introduction', link: '/guide'}, - {text: 'Demo app', link: '/guide/demo-application'}, + { text: "Introduction", link: "/guide" }, + { text: "Demo app", link: "/guide/demo-application" }, ], }, { - text: 'Installation', + text: "Installation", items: [ - {text: 'Server-side', link: '/guide/server-side-setup'}, - {text: 'Client-side', link: '/guide/client-side-setup'}, - ] + { text: "Server-side", link: "/guide/server-side-setup" }, + { text: "Client-side", link: "/guide/client-side-setup" }, + ], }, { - text: 'Core concepts', + text: "Core concepts", items: [ - {text: 'Who is it for', link: '/guide/who-is-it-for'}, - {text: 'How it works', link: '/guide/how-it-works'}, - {text: 'The protocol', link: '/guide/the-protocol'}, - ] + { text: "Who is it for", link: "/guide/who-is-it-for" }, + { text: "How it works", link: "/guide/how-it-works" }, + { text: "The protocol", link: "/guide/the-protocol" }, + ], }, { - text: 'The basics', + text: "The basics", items: [ - {text: 'Pages', link: '/guide/pages'}, - {text: 'Responses', link: '/guide/responses'}, - {text: 'Redirects', link: '/guide/redirects'}, - {text: 'Routing', link: '/guide/routing'}, - {text: 'Title & meta', link: '/guide/title-and-meta'}, - {text: 'Links', link: '/guide/links'}, - {text: 'Manual visits', link: '/guide/manual-visits'}, - {text: 'Forms', link: '/guide/forms'}, - {text: 'File uploads', link: '/guide/file-uploads'}, - {text: 'Validation', link: '/guide/validation'}, - {text: 'Shared data', link: '/guide/shared-data'}, - ] + { text: "Pages", link: "/guide/pages" }, + { text: "Responses", link: "/guide/responses" }, + { text: "Redirects", link: "/guide/redirects" }, + { text: "Routing", link: "/guide/routing" }, + { text: "Title & meta", link: "/guide/title-and-meta" }, + { text: "Links", link: "/guide/links" }, + { text: "Manual visits", link: "/guide/manual-visits" }, + { text: "Forms", link: "/guide/forms" }, + { text: "File uploads", link: "/guide/file-uploads" }, + { text: "Validation", link: "/guide/validation" }, + { text: "Shared data", link: "/guide/shared-data" }, + ], }, { - text: 'Advanced', + text: "Advanced", items: [ - {text: 'Events', link: '/guide/events'}, - {text: 'Testing', link: '/guide/testing'}, - {text: 'Partial reloads', link: '/guide/partial-reloads'}, - {text: 'Scroll management', link: '/guide/scroll-management'}, - {text: 'Authentication', link: '/guide/authentication'}, - {text: 'Authorization', link: '/guide/authorization'}, - {text: 'CSRF protection', link: '/guide/csrf-protection'}, - {text: 'Error handling', link: '/guide/error-handling'}, - {text: 'Asset versioning', link: '/guide/asset-versioning'}, - {text: 'Progress indicators', link: '/guide/progress-indicators'}, - {text: 'Remembering state', link: '/guide/remembering-state'}, - {text: 'Code splitting', link: '/guide/code-splitting'}, - {text: 'Server-side rendering', link: '/guide/server-side-rendering'}, - ] - } + { text: "Events", link: "/guide/events" }, + { text: "Testing", link: "/guide/testing" }, + { text: "Partial reloads", link: "/guide/partial-reloads" }, + { text: "Scroll management", link: "/guide/scroll-management" }, + { text: "Authentication", link: "/guide/authentication" }, + { text: "Authorization", link: "/guide/authorization" }, + { text: "CSRF protection", link: "/guide/csrf-protection" }, + { text: "Error handling", link: "/guide/error-handling" }, + { text: "Asset versioning", link: "/guide/asset-versioning" }, + { text: "Progress indicators", link: "/guide/progress-indicators" }, + { text: "Remembering state", link: "/guide/remembering-state" }, + { text: "Code splitting", link: "/guide/code-splitting" }, + { + text: "Server-side rendering", + link: "/guide/server-side-rendering", + }, + ], + }, ], - '/cookbook': [ + "/cookbook": [ { items: [ { - text: 'Integrations', + text: "Integrations", items: [ - {text: 'shadcn/ui', link: '/cookbook/integrating-shadcn-ui'}, - ] + { text: "shadcn/ui", link: "/cookbook/integrating-shadcn-ui" }, + ], }, ], }, @@ -129,23 +139,24 @@ export default defineConfig({ }, search: { - provider: 'algolia', + provider: "algolia", options: { appId: "NFLARHZ4Q4", apiKey: "5e79b6038b027b5bb342ea5a31d0a2e8", indexName: "inertia-rails", - } + }, }, editLink: { - pattern: 'https://github.com/skryukov/inertia_rails-contrib/edit/main/docs/:path', - text: 'Edit this page on GitHub' + pattern: + "https://github.com/skryukov/inertia_rails-contrib/edit/main/docs/:path", + text: "Edit this page on GitHub", }, socialLinks: [ - {icon: 'github', link: 'https://github.com/inertiajs/inertia-rails'}, - {icon: 'x', link: 'https://x.com/inertiajs'}, - {icon: 'discord', link: 'https://discord.gg/inertiajs'}, + { icon: "github", link: "https://github.com/inertiajs/inertia-rails" }, + { icon: "x", link: "https://x.com/inertiajs" }, + { icon: "discord", link: "https://discord.gg/inertiajs" }, ], - } -}) + }, +}); diff --git a/docs/.vitepress/theme/frameworksTabs.ts b/docs/.vitepress/theme/frameworksTabs.ts index d7a4635..4868801 100644 --- a/docs/.vitepress/theme/frameworksTabs.ts +++ b/docs/.vitepress/theme/frameworksTabs.ts @@ -1,24 +1,24 @@ -const localStorageKey = 'vitepress:tabsSharedState' -const ls = typeof localStorage !== 'undefined' ? localStorage : null +const localStorageKey = "vitepress:tabsSharedState"; +const ls = typeof localStorage !== "undefined" ? localStorage : null; const getLocalStorageValue = (): Record => { - const rawValue = ls?.getItem(localStorageKey) + const rawValue = ls?.getItem(localStorageKey); if (rawValue) { try { - return JSON.parse(rawValue) + return JSON.parse(rawValue); } catch {} } - return {} -} + return {}; +}; const setLocalStorageValue = (v: Record) => { - if (!ls) return - ls.setItem(localStorageKey, JSON.stringify(v)) -} + if (!ls) return; + ls.setItem(localStorageKey, JSON.stringify(v)); +}; export const setupFrameworksTabs = () => { - const v = getLocalStorageValue() + const v = getLocalStorageValue(); if (!v.frameworks) { - setLocalStorageValue({"frameworks":"React"}) + setLocalStorageValue({ frameworks: "React" }); } -} +}; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 99d3d29..b21c9a1 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,22 +1,22 @@ // https://vitepress.dev/guide/custom-theme -import { h } from 'vue' -import type { Theme } from 'vitepress' -import DefaultTheme from 'vitepress/theme' -import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' -import { setupFrameworksTabs } from './frameworksTabs' -import './style.css' +import { h } from "vue"; +import type { Theme } from "vitepress"; +import DefaultTheme from "vitepress/theme"; +import { enhanceAppWithTabs } from "vitepress-plugin-tabs/client"; +import { setupFrameworksTabs } from "./frameworksTabs"; +import "./style.css"; export default { extends: DefaultTheme, Layout: () => { return h(DefaultTheme.Layout, null, { // https://vitepress.dev/guide/extending-default-theme#layout-slots - }) + }); }, enhanceApp({ app, router, siteData }) { - enhanceAppWithTabs(app) + enhanceAppWithTabs(app); }, setup() { - setupFrameworksTabs() - } -} satisfies Theme + setupFrameworksTabs(); + }, +} satisfies Theme; diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css index 30b8be3..83bf35e 100644 --- a/docs/.vitepress/theme/style.css +++ b/docs/.vitepress/theme/style.css @@ -93,15 +93,15 @@ :root { --vp-home-hero-name-color: transparent; --vp-home-hero-name-background: -webkit-linear-gradient( - 0deg, - #9553e9, - #6d74ed + 0deg, + #9553e9, + #6d74ed ); --vp-home-hero-image-background-image: linear-gradient( - -45deg, - #9553e9 50%, - #6d74ed 50% + -45deg, + #9553e9 50%, + #6d74ed 50% ); --vp-home-hero-image-filter: blur(44px); } @@ -153,11 +153,11 @@ padding: 0 !important; } -.plugin-tabs--content div[class*='language-'] { +.plugin-tabs--content div[class*="language-"] { background-color: var(--vp-code-block-bg) !important; } -.plugin-tabs--content div[class*='language-']:first-child { +.plugin-tabs--content div[class*="language-"]:first-child { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; } @@ -172,4 +172,4 @@ .plugin-tabs--content:has(> p:first-child) p { margin-top: 16px !important; padding-left: 16px; -} \ No newline at end of file +}