Skip to content

Commit

Permalink
fix dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
noahjoeris committed Aug 15, 2024
1 parent 8263875 commit b9fe3a5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 27 deletions.
1 change: 0 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"react-hook-form": "7.51.4",
"sharp": "^0.33.3",
"tailwind-merge": "^2.3.0",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss-animate": "^1.0.7",
"viem": "^2.10.8",
"wagmi": "^2.8.8",
Expand Down
13 changes: 0 additions & 13 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/src/components/ChainSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const ChainSelect = forwardRef<HTMLDivElement, ChainSelectProps>(
</div>
</Tooltip>

<Dropdown isOpen={isOpen} dropdownRef={dropdownRef} disableScroll={options.length < 7}>
<Dropdown isOpen={isOpen} dropdownRef={dropdownRef}>
{options.map(option => (
<li
key={option.uid}
Expand Down
7 changes: 2 additions & 5 deletions app/src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ interface DropdownProps {
isOpen: boolean
dropdownRef: RefObject<HTMLDivElement>
children: ReactNode
/** Disables scroll on dropdown. Used to disable scroll on dropdowns with few items to prevent animation flickering. */
disableScroll?: boolean
}

const Dropdown: FC<DropdownProps> = ({ isOpen, dropdownRef, children, disableScroll }) => {
const Dropdown: FC<DropdownProps> = ({ isOpen, dropdownRef, children }) => {
return (
<AnimatePresence>
{isOpen && (
Expand All @@ -18,7 +16,6 @@ const Dropdown: FC<DropdownProps> = ({ isOpen, dropdownRef, children, disableScr
initial={{ height: '3.6rem' }}
animate={{
height: 'auto',
overflowY: disableScroll ? 'hidden' : 'auto',
transition: {
type: 'spring',
bounce: 0.4,
Expand All @@ -29,7 +26,7 @@ const Dropdown: FC<DropdownProps> = ({ isOpen, dropdownRef, children, disableScr
height: '3.6rem',
transition: { duration: 0.06 },
}}
className="absolute left-0 right-0 top-0 z-20 max-h-[18rem] scroll-m-1 rounded-md border-1 border-turtle-level3 bg-white scrollbar-thin scrollbar-track-white scrollbar-thumb-turtle-level2"
className="absolute left-0 right-0 top-0 z-20 max-h-[16.5rem] overflow-y-auto rounded-md border-1 border-turtle-level3 bg-white"
>
<ul className="flex flex-col gap-2 px-1 py-2">{children}</ul>
</motion.div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/TokenAmountSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const TokenAmountSelect = forwardRef<HTMLDivElement, TokenAmountSelectProps>(
</Tooltip>

{/* Dropdown */}
<Dropdown isOpen={isOpen} dropdownRef={dropdownRef} disableScroll={options.length < 7}>
<Dropdown isOpen={isOpen} dropdownRef={dropdownRef}>
{options.map(option => {
if (option.token === null) return null
return (
Expand Down
7 changes: 1 addition & 6 deletions app/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ const config: Config = {
},
},
darkMode: 'class',
plugins: [
addVariablesForColors,
nextui(),
require('tailwindcss-animate'),
require('tailwind-scrollbar')({ preferredStrategy: 'pseudoelements' }),
],
plugins: [addVariablesForColors, nextui(), require('tailwindcss-animate')],
}
export default config

Expand Down

0 comments on commit b9fe3a5

Please sign in to comment.