From d7e52c1969391e340303b5eea754df38155de6cd Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 8 Jun 2022 14:23:10 -0500 Subject: [PATCH] Extract TextButton component with blue underline. --- web/components/following-button.tsx | 40 ++++++++++------------------- web/components/text-button.tsx | 22 ++++++++++++++++ web/components/user-page.tsx | 2 +- 3 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 web/components/text-button.tsx diff --git a/web/components/following-button.tsx b/web/components/following-button.tsx index f880d127..b5ae77a6 100644 --- a/web/components/following-button.tsx +++ b/web/components/following-button.tsx @@ -1,4 +1,3 @@ -import clsx from 'clsx' import { PencilIcon } from '@heroicons/react/outline' import { User } from 'common/user' import { useEffect, useState } from 'react' @@ -9,31 +8,28 @@ import { Col } from './layout/col' import { Modal } from './layout/modal' import { Tabs } from './layout/tabs' import { useDiscoverUsers } from 'web/hooks/use-users' +import { TextButton } from './text-button' export function FollowingButton(props: { user: User }) { const { user } = props - const [open, setOpen] = useState(false) + const [isOpen, setIsOpen] = useState(false) const followingIds = useFollows(user.id) const followerIds = useFollowers(user.id) return ( <> -
setOpen(true)} - > + setIsOpen(true)}> {followingIds?.length ?? ''}{' '} Following -
+ ) @@ -41,18 +37,12 @@ export function FollowingButton(props: { user: User }) { export function EditFollowingButton(props: { user: User; className?: string }) { const { user, className } = props - const [open, setOpen] = useState(false) + const [isOpen, setIsOpen] = useState(false) const followingIds = useFollows(user.id) const followerIds = useFollowers(user.id) return ( -
setOpen(true)} - > + setIsOpen(true)}> Following -
+ ) } @@ -75,14 +65,10 @@ export function FollowersButton(props: { user: User }) { return ( <> -
setIsOpen(true)} - > + setIsOpen(true)}> {followerIds?.length ?? ''}{' '} Followers -
+ void + children: React.ReactNode + className?: string +}) { + const { onClick, children, className } = props + + return ( +
+ {children} +
+ ) +} diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index 8b63d01e..08d0c754 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -161,7 +161,7 @@ export function UserPage(props: { )} - +