-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
854 additions
and
779 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
[package] | ||
name = "robyn" | ||
version = "0.64.2" | ||
version = "0.65.0" | ||
authors = ["Sanskar Jethi <[email protected]>"] | ||
edition = "2021" | ||
description = "Robyn is a Super Fast Async Python Web Framework with a Rust runtime." | ||
|
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
72 changes: 72 additions & 0 deletions
72
docs_src/src/components/documentation/LanguageSelector.jsx
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { useRouter } from 'next/router' | ||
import { Menu } from '@headlessui/react' | ||
import { motion } from 'framer-motion' | ||
|
||
const languages = [ | ||
{ code: 'en', name: 'English' }, | ||
{ code: 'zh', name: '中文' }, | ||
] | ||
|
||
function LanguageSelector() { | ||
const router = useRouter() | ||
const { pathname, asPath, query } = router | ||
const currentLanguage = asPath.includes('/zh') ? 'zh' : 'en' | ||
|
||
const changeLanguage = (locale) => { | ||
const currentPath = asPath.split('?')[0] | ||
|
||
if (currentPath === '/documentation' || currentPath === '/documentation/') { | ||
router.push(`/documentation/${locale}`) | ||
return | ||
} | ||
|
||
const newPath = currentPath.replace( | ||
/\/documentation\/(en|zh)/, | ||
`/documentation/${locale}` | ||
) | ||
|
||
router.push(newPath) | ||
} | ||
|
||
return ( | ||
<Menu as="div" className="relative"> | ||
<Menu.Button className="flex items-center gap-2 rounded-lg bg-zinc-800/40 px-3 py-2 text-sm text-white hover:bg-zinc-800 transition-colors duration-200"> | ||
{languages.find(l => l.code === currentLanguage)?.name} | ||
<svg | ||
width="8" | ||
height="5" | ||
className="ml-1 stroke-current" | ||
fill="none" | ||
viewBox="0 0 8 5" | ||
> | ||
<path d="M1 1L4 4L7 1" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /> | ||
</svg> | ||
</Menu.Button> | ||
<Menu.Items as={motion.div} | ||
initial={{ y: -10 }} | ||
animate={{ y: 0 }} | ||
exit={{ y: -10 }} | ||
className="absolute left-0 mt-1 w-40 origin-top-left rounded-lg bg-[#27272A] ring-1 ring-zinc-700 shadow-xl z-50" | ||
> | ||
{languages.map((language) => ( | ||
<Menu.Item key={language.code}> | ||
{({ active }) => ( | ||
<button | ||
onClick={() => changeLanguage(language.code)} | ||
className={`${ | ||
active ? 'bg-zinc-700/50' : '' | ||
} ${ | ||
currentLanguage === language.code ? 'bg-orange-500/10 text-orange-500' : 'text-zinc-100' | ||
} group flex w-full items-center gap-2 rounded-md px-3 py-2.5 text-sm transition-colors duration-200`} | ||
> | ||
{language.name} | ||
</button> | ||
)} | ||
</Menu.Item> | ||
))} | ||
</Menu.Items> | ||
</Menu> | ||
) | ||
} | ||
|
||
export default LanguageSelector |
Oops, something went wrong.