Skip to content

Commit

Permalink
Fix: Remove daisyui and recreate localedropdown using pure tailwind css
Browse files Browse the repository at this point in the history
Signed-off-by: George J Padayatti <[email protected]>
  • Loading branch information
georgepadayatti committed Apr 2, 2024
1 parent 165c9be commit b9e0b07
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 38 deletions.
50 changes: 21 additions & 29 deletions src/components/LocaleDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import NavbarItem from "@theme/NavbarItem";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { useAlternatePageUtils } from "@docusaurus/theme-common/internal";
import { useLocation } from "@docusaurus/router";
import "./localedropdown.css"

export default function LocaleDropDown() {
const {
Expand Down Expand Up @@ -33,9 +34,9 @@ export default function LocaleDropDown() {
const to = `${baseTo}${search}${hash}`;
return {
label: (
<>
<a className="rounded-t py-2 px-4 block whitespace-no-wrap">
{getFlagEmojiForCountry(locale)} {localeConfigs[locale].label}
</>
</a>
),
lang: localeConfigs[locale].htmlLang,
to,
Expand All @@ -54,33 +55,24 @@ export default function LocaleDropDown() {
);

return (
<div
className={clsx(
"dropdown",
"dropdown-bottom",
"dropdown-end",
"dropdown-hover",
"mr-2",
"sm:mr-2"
)}
>
<label tabIndex="0" className="m-1 flex items-center cursor-pointer">
{dropDownLabel}
</label>

<ul
tabIndex="0"
className="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52"
>
{items.map((childItemProps, i) => (
<NavbarItem
isDropdownItem
activeClassName="dropdown__link--active"
{...childItemProps}
key={i}
/>
))}
</ul>
<div className="p-0">
<div className="dropdown inline-block relative">
<button className=" text-gray-700 font-semibold py-2 px-4 inline-flex items-center">
<span className="mr-1">{dropDownLabel}</span>
</button>
<ul className="dropdown-menu absolute rounded hidden text-gray-700 pt-1 bg-[#edf2f7]">
{items.map((childItemProps, i) => (
<NavbarItem
isDropdownItem
activeClassName="dropdown__link--active"
{...childItemProps}
key={i}
/>
))}
</ul>
</div>
</div>


);
}
10 changes: 10 additions & 0 deletions src/components/LocaleDropdown/localedropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.buttons {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.dropdown:hover .dropdown-menu {
display: block;
}
9 changes: 1 addition & 8 deletions src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,4 @@
.heroBanner {
padding: 2rem;
}
}

.buttons {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
theme: {
extend: {},
},
plugins: [require("@tailwindcss/forms"), require("daisyui")],
plugins: [require("@tailwindcss/forms")],
};

0 comments on commit b9e0b07

Please sign in to comment.