-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Migrate table docs to v2 layout (#149)
* Rework table docs * Fix merge * More code from store docs * Fix docs path * Remove non-null assertions * Remove v8branch variable * Unify useProjectDocsConfig hook * Fix function name * Replace hard-coded repo * Derive `Framework` type * Add shared useDocsConfig hook * Remove 301 redirects * Forgot to stage
- Loading branch information
1 parent
ac08936
commit 33ef71e
Showing
20 changed files
with
417 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,81 @@ | ||
import { Link } from '@remix-run/react' | ||
import reactLogo from '~/images/react-logo.svg' | ||
import solidLogo from '~/images/solid-logo.svg' | ||
import vueLogo from '~/images/vue-logo.svg' | ||
import svelteLogo from '~/images/svelte-logo.svg' | ||
import { FaDiscord, FaGithub } from 'react-icons/fa' | ||
import { useDocsConfig } from '~/utils/config' | ||
import type { ConfigSchema, MenuItem } from '~/utils/config' | ||
|
||
export const repo = 'tanstack/table' | ||
|
||
export const v8branch = 'main' | ||
export const latestBranch = 'main' | ||
export const latestVersion = 'v8' | ||
export const availableVersions = ['v8'] | ||
|
||
export const gradientText = | ||
'inline-block text-transparent bg-clip-text bg-gradient-to-r from-teal-500 to-blue-600' | ||
|
||
const frameworks = { | ||
react: { label: 'React', logo: reactLogo, value: 'react' }, | ||
solid: { label: 'Solid', logo: solidLogo, value: 'solid' }, | ||
svelte: { label: 'Svelte', logo: svelteLogo, value: 'svelte' }, | ||
vue: { label: 'Vue', logo: vueLogo, value: 'vue' }, | ||
} as const | ||
|
||
export type Framework = keyof typeof frameworks | ||
|
||
export function getBranch(argVersion?: string) { | ||
const version = argVersion || latestVersion | ||
|
||
return ['latest', latestVersion].includes(version) ? latestBranch : version | ||
} | ||
|
||
export const localMenu: MenuItem = { | ||
label: 'Menu', | ||
children: [ | ||
{ | ||
label: 'Home', | ||
to: '..', | ||
}, | ||
{ | ||
label: ( | ||
<div className="flex items-center gap-2"> | ||
GitHub <FaGithub className="text-lg opacity-20" /> | ||
</div> | ||
), | ||
to: `https://github.com/${repo}`, | ||
}, | ||
{ | ||
label: ( | ||
<div className="flex items-center gap-2"> | ||
Discord <FaDiscord className="text-lg opacity-20" /> | ||
</div> | ||
), | ||
to: 'https://tlinz.com/discord', | ||
}, | ||
], | ||
} | ||
|
||
export const createLogo = (version?: string) => ( | ||
<> | ||
<Link to="/" className="font-light"> | ||
TanStack | ||
</Link> | ||
<Link to="../../" className={`font-bold`}> | ||
<span className={`${gradientText}`}>Table</span>{' '} | ||
<span className="text-sm align-super"> | ||
{version === 'latest' ? latestVersion : version} | ||
</span> | ||
</Link> | ||
</> | ||
) | ||
|
||
export const useTableDocsConfig = (config: ConfigSchema) => { | ||
return useDocsConfig({ | ||
config, | ||
frameworks, | ||
localMenu, | ||
availableVersions, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { redirect } from '@remix-run/node' | ||
|
||
export const loader = () => { | ||
return redirect(`/form/latest`, 301) | ||
return redirect('/form/latest') | ||
} |
Oops, something went wrong.
33ef71e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
tanstack-com – ./
tanstack-com-git-main-tanstack.vercel.app
tanstack-com-tanstack.vercel.app
tanstack.com
tanstack-com.vercel.app