Skip to content

Commit

Permalink
refactor: shifts the loader to the button, follow button only toggles…
Browse files Browse the repository at this point in the history
… it on/off
  • Loading branch information
araujobarret committed Sep 16, 2024
1 parent 55d2d6a commit 1929b17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/elements/Button/FollowButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CheckIcon } from "../../svgs/CheckIcon"
import { formatLargeNumber } from "../../utils/formatLargeNumber"
import { Button, ButtonProps } from "../Button"
import { Spinner } from "../Spinner"
import { Text } from "../Text"

type FollowButtonProps = Omit<
Expand All @@ -20,6 +19,7 @@ export const FollowButton = ({
loading,
...restProps
}: FollowButtonProps) => {
const label = isFollowed ? "Following" : "Follow"
return (
<Button
variant={isFollowed ? "outline" : "outlineGray"}
Expand All @@ -29,11 +29,11 @@ export const FollowButton = ({
loading={loading}
{...restProps}
>
{loading ? (
<Spinner size="small" />
{!!loading ? (
`${label} ${followCount && followCount > 1 ? formatLargeNumber(followCount, 1) : ""}`
) : (
<>
<Text variant="xs">{isFollowed ? "Following" : "Follow"}</Text>
<Text variant="xs">{label}</Text>
{!!followCount && followCount > 1 && (
<Text variant="xs" color="black60">
{" " + formatLargeNumber(followCount, 1)}
Expand Down

0 comments on commit 1929b17

Please sign in to comment.