Skip to content

Commit

Permalink
fix: made the links width 100% (#1955)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Gornicki <[email protected]>
  • Loading branch information
shubhamku044 and derberg authored Jul 26, 2023
1 parent 67885a2 commit cb5354b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions components/navigation/DocsNavItem.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import Link from 'next/link';

function isActiveSlug(slug, activeSlug, sectionSlug) {
if(slug === '/docs' || (sectionSlug !== undefined && slug === sectionSlug)) {
if (slug === '/docs' || (sectionSlug !== undefined && slug === sectionSlug)) {
return (slug == activeSlug)
}

const partialSlug = slug.split('/');
const partialActiveSlug = activeSlug.split('/');
const activeParts = partialActiveSlug.filter((a, idx) => a === partialSlug[idx]);
return activeParts.length === partialSlug.length;
}

export default function DocsNavItem({ title, slug, href, activeSlug, sectionSlug, onClick = () => {}, defaultClassName = '', inactiveClassName = '', activeClassName = '', bucket }) {
export default function DocsNavItem({ title, slug, href, activeSlug, sectionSlug, onClick = () => { }, defaultClassName = '', inactiveClassName = '', activeClassName = '', bucket }) {
const isActive = isActiveSlug(slug, activeSlug, sectionSlug);
const classes = `${isActive ? activeClassName : inactiveClassName} ${defaultClassName} inline-block`;
const classes = `${isActive ? activeClassName : inactiveClassName} ${defaultClassName} inline-block w-full`;

return (
<div className='inline-block'>
<div>
<div className={classes}>
<Link href={href || slug}>
<a href={href || slug} onClick={onClick}>
<a className='inline-block w-full' href={href || slug} onClick={onClick}>
{bucket && (
<div className={`${(slug === '/docs' ? slug === activeSlug : activeSlug.startsWith(slug)) ? bucket.className : ''} inline-block rounded`} style={{ marginRight: '5px', marginBottom: '-6px', padding: '2px' }}>
<bucket.icon className='h-5 w-5' />
Expand All @@ -31,4 +31,4 @@ export default function DocsNavItem({ title, slug, href, activeSlug, sectionSlug
</div>
</div>
);
}
}

0 comments on commit cb5354b

Please sign in to comment.