Skip to content

Commit

Permalink
🎨 review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Dec 12, 2024
1 parent f85f5bd commit 47d5d7f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 53 deletions.
2 changes: 1 addition & 1 deletion web/core/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface AccordionMultipleProps extends _Accordion.AccordionMultipleProp
type: 'multiple'
}

export type Variants = 'primary' | 'menu' | 'simple_menu'
export type Variants = 'primary' | 'menu' | 'simpleMenu'

/**
* Accordion
Expand Down
19 changes: 2 additions & 17 deletions web/core/Accordion/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,11 @@ export const Content = forwardRef<HTMLDivElement, AccordionContentProps>(functio
max-lg:motion-safe:data-closed:animate-slideDown
max-lg:motion-safe:data-open:animate-slideUp
`,
simple_menu: `max-lg:overflow-hidden
simpleMenu: `max-lg:overflow-hidden
max-lg:motion-safe:data-closed:animate-slideDown
max-lg:motion-safe:data-open:animate-slideUp`,
}

/**
*
* motion-safe:data-open:xl:animate-fadeIn
motion-safe:data-closed:xl:animate-fadeOut
* xl:absolute
xl:left-0
xl:top-[260px]
xl:right-0
xl:transition-visibility
xl:duration-300
xl:ease-in-out
overflow-hidden
*/

const getVariantBody = () => {
switch (variant) {
case 'menu':
Expand All @@ -65,7 +50,7 @@ export const Content = forwardRef<HTMLDivElement, AccordionContentProps>(functio
{children}
</motion.div>
)
case 'simple_menu':
case 'simpleMenu':
return <div className="pl-4 py-6 xl:py-10">{children}</div>

default:
Expand Down
6 changes: 3 additions & 3 deletions web/core/Accordion/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Header = forwardRef<HTMLButtonElement, AccordionHeaderProps>(functi
const headerVariantClassName: Partial<Record<Variants, string>> = {
primary: '',
menu: '',
simple_menu: '',
simpleMenu: '',
}
const variantClassName: Partial<Record<Variants, string>> = {
primary: `
Expand Down Expand Up @@ -62,7 +62,7 @@ export const Header = forwardRef<HTMLButtonElement, AccordionHeaderProps>(functi
xl:border-b-2
data-open:xl:border-moss-green-95
data-open:xl:font-normal`,
simple_menu: `py-3
simpleMenu: `py-3
px-2
items-center
text-base
Expand All @@ -76,7 +76,7 @@ export const Header = forwardRef<HTMLButtonElement, AccordionHeaderProps>(functi
const textVariantClassName: Partial<Record<Variants, string>> = {
primary: 'text-base',
menu: 'text-base xl:text-sm',
simple_menu: 'text-base xl:text-sm',
simpleMenu: 'text-base xl:text-sm',
}

return (
Expand Down
2 changes: 1 addition & 1 deletion web/core/Accordion/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Item = forwardRef<HTMLDivElement, AccordionItemProps>(function Item
const variantClassName: Partial<Record<Variants, string>> = {
primary: 'border-b border-grey-40 dark:border-white-100',
menu: '',
simple_menu: 'border-b border-grey-40 dark:border-white-100',
simpleMenu: 'border-b border-grey-40 dark:border-white-100',
}
return (
<AccordionItem ref={forwardedRef} {...rest} className={envisTwMerge(`${variantClassName[variant]}`, className)}>
Expand Down
7 changes: 1 addition & 6 deletions web/core/MenuAccordion/MenuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ export const MenuContent = forwardRef<HTMLDivElement, MenuContentProps>(function
ref,
) {
return (
<Accordion.Content
variant={variant === 'simple' ? 'simple_menu' : 'menu'}
ref={ref}
className={className}
{...rest}
>
<Accordion.Content variant={variant === 'simple' ? 'simpleMenu' : 'menu'} ref={ref} className={className} {...rest}>
{children}
</Accordion.Content>
)
Expand Down
2 changes: 1 addition & 1 deletion web/core/MenuAccordion/MenuHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const MenuHeader = forwardRef<HTMLButtonElement, MenuHeaderProps>(functio
return (
<Accordion.Header
ref={ref}
variant={variant === 'simple' ? 'simple_menu' : 'menu'}
variant={variant === 'simple' ? 'simpleMenu' : 'menu'}
className={envisTwMerge(`${variantClassName[variant]}`, className)}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion web/core/MenuAccordion/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type MenuItemProps = {

export const MenuItem = ({ children, variant = 'default', ...rest }: MenuItemProps) => {
return (
<Accordion.Item variant={variant === 'simple' ? 'simple_menu' : 'menu'} asChild {...rest}>
<Accordion.Item variant={variant === 'simple' ? 'simpleMenu' : 'menu'} asChild {...rest}>
<li>{children}</li>
</Accordion.Item>
)
Expand Down
14 changes: 1 addition & 13 deletions web/sections/SiteMenu/SimpleMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const SimpleMenuItem = ({ item, index }: MenuGroupType) => {
`}
>
{links?.map((link: any) => (
<li className="" key={link.id}>
<li key={link.id}>
<Link
className={`aria-current:bg-grey-10
aria-current:px-2
Expand All @@ -91,18 +91,6 @@ export const SimpleMenuItem = ({ item, index }: MenuGroupType) => {
hover:underline
underline-offset-2
text-sm`}
/**
* flex
aria-current:bg-grey-10
hover:bg-grey-10
m-0
no-underline
px-md
py-xs+sm
xl:ml-[calc(var(--space-medium)_*_(-1))]
aria-current:border-l-[3px]
aria-current:border-moss-green-95
*/
href={link?.link?.slug || '/'}
aria-current={router?.asPath == link?.link?.slug ? 'page' : 'false'}
>
Expand Down
17 changes: 7 additions & 10 deletions web/sections/SiteMenu/SiteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const SiteMenu = ({ data, variant = 'default', ...rest }: MenuProps) => {
const allSitesURL = getAllSitesLink('internal', router?.locale || 'en')

const getCurrentMenuItemIndex = () => {
const temp = menuItems
return menuItems
.findIndex((menuItem) => {
if (variant === 'simple') {
if ('link' in menuItem && menuItem?.link) {
Expand All @@ -65,8 +65,6 @@ const SiteMenu = ({ data, variant = 'default', ...rest }: MenuProps) => {
}
})
.toString()
console.log('temo', temp)
return temp
}

const variantClassName: Partial<Record<Variants, string>> = {
Expand Down Expand Up @@ -116,13 +114,12 @@ const SiteMenu = ({ data, variant = 'default', ...rest }: MenuProps) => {
${
variant === 'simple'
? 'py-4 xl:py-6 text-sm'
: `py-6
px-2
xl:px-6
xl:my-4
xl:py-4
text-base
`
: `py-6
px-2
xl:px-6
xl:my-4
xl:py-4
text-base`
}
xl:text-sm
leading-none
Expand Down

0 comments on commit 47d5d7f

Please sign in to comment.