forked from crowetic/commerce
I18n Better Experience
This commit is contained in:
parent
bbcf63b892
commit
c37ed3d418
@ -6,6 +6,10 @@
|
|||||||
@apply h-10 px-2 rounded-md border border-accents-2 flex items-center justify-center;
|
@apply h-10 px-2 rounded-md border border-accents-2 flex items-center justify-center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
@apply border-accents-4 shadow-sm;
|
||||||
|
}
|
||||||
|
|
||||||
.button:focus {
|
.button:focus {
|
||||||
@apply outline-none;
|
@apply outline-none;
|
||||||
}
|
}
|
||||||
@ -18,6 +22,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.closeButton {
|
||||||
|
@screen md {
|
||||||
|
@apply hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
@apply flex cursor-pointer px-6 py-3 flex transition ease-in-out duration-150 text-primary leading-6 font-medium items-center;
|
@apply flex cursor-pointer px-6 py-3 flex transition ease-in-out duration-150 text-primary leading-6 font-medium items-center;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
@ -26,3 +36,7 @@
|
|||||||
.item:hover {
|
.item:hover {
|
||||||
@apply bg-accents-1;
|
@apply bg-accents-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
@ -3,7 +3,7 @@ import Link from 'next/link'
|
|||||||
import { FC, useState } from 'react'
|
import { FC, useState } from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import s from './I18nWidget.module.css'
|
import s from './I18nWidget.module.css'
|
||||||
import { Cross } from '@components/icons'
|
import { Cross, ChevronUp } from '@components/icons'
|
||||||
interface LOCALE_DATA {
|
interface LOCALE_DATA {
|
||||||
name: string
|
name: string
|
||||||
img: {
|
img: {
|
||||||
@ -43,29 +43,21 @@ const I18nWidget: FC = () => {
|
|||||||
return (
|
return (
|
||||||
<nav className={s.root}>
|
<nav className={s.root}>
|
||||||
<div className="flex items-center relative">
|
<div className="flex items-center relative">
|
||||||
<button className={s.button} aria-label="Language selector" />
|
<button className={s.button} aria-label="Language selector">
|
||||||
<img
|
<img
|
||||||
className="block mr-2 w-5"
|
className="block mr-2 w-5"
|
||||||
src={`/${LOCALES_MAP[currentLocale].img.filename}`}
|
src={`/${LOCALES_MAP[currentLocale].img.filename}`}
|
||||||
alt={LOCALES_MAP[currentLocale].img.alt}
|
alt={LOCALES_MAP[currentLocale].img.alt}
|
||||||
/>
|
/>
|
||||||
{options && (
|
{options && (
|
||||||
<span className="cursor-pointer" onClick={() => setDisplay(!display)}>
|
<span
|
||||||
<svg
|
className="cursor-pointer"
|
||||||
viewBox="0 0 24 24"
|
onClick={() => setDisplay(!display)}
|
||||||
width="24"
|
|
||||||
height="24"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="1.5"
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
fill="none"
|
|
||||||
shapeRendering="geometricPrecision"
|
|
||||||
>
|
>
|
||||||
<path d="M6 9l6 6 6-6" />
|
<ChevronUp className={cn({ [s.icon]: display })} />
|
||||||
</svg>
|
</span>
|
||||||
</span>
|
)}
|
||||||
)}
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="absolute top-0 right-0">
|
<div className="absolute top-0 right-0">
|
||||||
{options?.length && display ? (
|
{options?.length && display ? (
|
||||||
|
20
components/icons/ChevronUp.tsx
Normal file
20
components/icons/ChevronUp.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const ChevronUp = ({ ...props }) => {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
fill="none"
|
||||||
|
shape-rendering="geometricPrecision"
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<path d="M18 15l-6-6-6 6" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ChevronUp
|
@ -12,3 +12,4 @@ export { default as Github } from './Github'
|
|||||||
export { default as DoubleChevron } from './DoubleChevron'
|
export { default as DoubleChevron } from './DoubleChevron'
|
||||||
export { default as RightArrow } from './RightArrow'
|
export { default as RightArrow } from './RightArrow'
|
||||||
export { default as Info } from './Info'
|
export { default as Info } from './Info'
|
||||||
|
export { default as ChevronUp } from './ChevronUp'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user