Skip to content

Commit

Permalink
fix(landing): prevent connectors image overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anteqkois committed Jun 8, 2024
1 parent c69072a commit 7ed4f1d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/web/app/(landing)/components/ConnectorLogos.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use client'

import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@linkerry/ui-components/client'
import { cn } from '@linkerry/ui-components/utils'
import Image from 'next/image'
import { HTMLAttributes } from 'react'
import { useBodyClass } from '../../../shared/hooks/useBodyClass'
import './connectorLogos.css'

const connectorNamesToShow = [
Expand Down Expand Up @@ -45,6 +47,9 @@ const ConnectorLogo = ({ connectorName }: ConnectorLogoProps) => {
export interface ConnectorImagesProps extends HTMLAttributes<HTMLElement> {}

export const ConnectorImages = ({ className, ...rest }: ConnectorImagesProps) => {
// the connectors image are overlfow X axies, so after mount, add class to body
useBodyClass('overflow-x-hidden')

return (
<section className={cn('scroll-container', className)} {...rest}>
<div className="carousel-primary">
Expand Down
1 change: 1 addition & 0 deletions apps/web/app/(landing)/components/connectorLogos.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.scroll-container {
overflow: hidden;
/* height: 100vh; */
}

Expand Down
33 changes: 33 additions & 0 deletions apps/web/shared/hooks/useBodyClass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use client'

import { useEffect } from 'react'

export const useBodyClass = (className: string) => {
useEffect(() => {
document.body.classList.add(className)

return () => {
document.body.classList.remove(className)
}
}, [className])
}
// 'use client'

// import { useRouter } from 'next/router'
// import { useEffect } from 'react'

// export const useBodyClass = (className: string, route: string) => {
// const router = useRouter()

// useEffect(() => {
// if (router.pathname === route) {
// document.body.classList.add(className)
// } else {
// document.body.classList.remove(className)
// }

// return () => {
// document.body.classList.remove(className)
// }
// }, [router.pathname, className, route])
// }

0 comments on commit 7ed4f1d

Please sign in to comment.