Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 ♻️ Rework Docs #2580

Merged
merged 14 commits into from
Dec 15, 2024
Prev Previous commit
Next Next commit
make version select work
joshbermanssw committed Dec 5, 2024

Verified

This commit was signed with the committer’s verified signature.
XeronOwO Xeron
commit fe7518f5cdd2490206cef6b3c5e8936b2dbbf990
37 changes: 27 additions & 10 deletions components/docsMain/docsMobileHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import { LeftHandSideHeader } from 'components/docsSearch/SearchNavigation';
import { useState } from 'react';
import { FaChevronRight } from 'react-icons/fa';
import { FaChevronRight } from 'react-icons/fa';
import DirectoryOverflowButton from './directoryOverflowButton';

export const MobileVersionSelect = () => {
const versions = ['v.Latest', 'v.0.68.13', 'v.0.67.3', 'v.Pre-Beta'];
const [versionSelected, setVersionSelected] = useState(versions[0]);
const versions = [
['v.Latest', 'https://tina.io'],
joshbermanssw marked this conversation as resolved.
Show resolved Hide resolved
[
'v.0.68.13',
'https://tinacms-site-next-i08bcbicy-tinacms.vercel.app/docs/',
],
['v.0.67.3', 'https://tinacms-site-next-pu1t2v9y4-tinacms.vercel.app/'],
['v.Pre-Beta', 'https://pre-beta.tina.io/'],
];
const [versionSelected, setVersionSelected] = useState(versions[0][0]);
const [isOverflowOpen, setIsOverflowOpen] = useState(false);

const handleVersionClick = (version) => {
setVersionSelected(version);
setIsOverflowOpen(false);
setVersionSelected(version[0]);
setIsOverflowOpen(false);

if (version[0] !== 'v.Latest') {
window.location.href = version[1];
}
};

return (
@@ -38,7 +50,7 @@ export const MobileVersionSelect = () => {
className="px-4 py-2 hover:bg-stone-100 cursor-pointer text-stone-600"
onClick={() => handleVersionClick(version)}
>
{version}
{version[0]}
</div>
))}
</div>
@@ -48,11 +60,16 @@ export const MobileVersionSelect = () => {
};

const DocsMobileHeader = (data) => {

return (
<div className='relative pb-20'>
<LeftHandSideHeader paddingGlobal='pb-6' headerColour='orange' headerPadding='' searchMargin='' searchBarPadding='py-3'/>
<DirectoryOverflowButton tocData={data.data.data.navDocData.data}/>
<div className="relative pb-20">
<LeftHandSideHeader
joshbermanssw marked this conversation as resolved.
Show resolved Hide resolved
paddingGlobal="pb-6"
headerColour="orange"
headerPadding=""
searchMargin=""
searchBarPadding="py-3"
/>
<DirectoryOverflowButton tocData={data.data.data.navDocData.data} />
</div>
);
};