Skip to content

Commit 12cc6c3

Browse files
authored
fix: migrate Dropdown component style from scss to tailwind css (#8082)
1 parent 7f85f94 commit 12cc6c3

2 files changed

Lines changed: 18 additions & 84 deletions

File tree

src/components/Dropdown/Dropdown.jsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import PropTypes from "prop-types";
22
import { Component } from "react";
33

4-
import "./Dropdown.scss";
5-
64
export default class Dropdown extends Component {
75
static propTypes = {
86
className: PropTypes.string,
@@ -41,11 +39,10 @@ export default class Dropdown extends Component {
4139

4240
render() {
4341
const { className = "", items = [] } = this.props;
44-
const activeMod = this.state.active ? "dropdown__list--active" : "";
4542

4643
return (
4744
<nav
48-
className={`dropdown ${className}`}
45+
className={`relative ${className}`}
4946
ref={(el) => (this.dropdown = el)}
5047
onMouseOver={this._handleMouseOver}
5148
onMouseLeave={this._handleMouseLeave}
@@ -56,11 +53,12 @@ export default class Dropdown extends Component {
5653
aria-expanded={String(this.state.active)}
5754
aria-label="Select language"
5855
onClick={this._handleClick}
56+
className="cursor-pointer text-white border-none bg-transparent m-0 p-0 text-[length:inherit] flex items-center"
5957
>
6058
<svg
6159
viewBox="0 0 610 560"
6260
xmlns="http://www.w3.org/2000/svg"
63-
className="dropdown__language text-gray-100 hover:text-blue-200 transition-colors duration-200"
61+
className="w-20 h-20 align-middle text-gray-100 hover:text-blue-200 transition-colors duration-200"
6462
>
6563
<path d="m304.8 99.2-162.5-57.3v353.6l162.5-52.6z" />
6664
<path
@@ -88,12 +86,19 @@ export default class Dropdown extends Component {
8886
</svg>
8987
{/* Commented out until media breakpoints are in place
9088
<span>{ items[0].title }</span> */}
91-
<i aria-hidden="true" className="dropdown__arrow" />
89+
<i aria-hidden="true" className="leading-none before:content-['▾']" />
9290
</button>
93-
<div className={`dropdown__list ${activeMod}`}>
94-
<ul>
91+
<div
92+
className={`${
93+
this.state.active ? "block" : "hidden"
94+
} absolute top-full right-0 text-[13px] bg-[#526b78] rounded-md shadow-[0_4px_12px_rgba(0,0,0,0.4)] z-[9999]`}
95+
>
96+
<ul className="pt-1">
9597
{items.map((item, i) => (
96-
<li key={item.title}>
98+
<li
99+
key={item.title}
100+
className="py-1 px-2 list-none text-white transition-all duration-[250ms] hover:bg-[#175d96]"
101+
>
97102
<a
98103
onKeyDown={(event) =>
99104
this._handleArrowKeys(i, items.length - 1, event)
@@ -102,9 +107,11 @@ export default class Dropdown extends Component {
102107
this.links ? this.links.push(node) : (this.links = [node])
103108
}
104109
href={item.url}
105-
className="px-5 block"
110+
className="px-5 block text-white visited:text-white hover:text-white"
106111
>
107-
<span lang={item.lang}>{item.title}</span>
112+
<span lang={item.lang} className="align-top text-left">
113+
{item.title}
114+
</span>
108115
</a>
109116
</li>
110117
))}

src/components/Dropdown/Dropdown.scss

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)