Make communities page subscribe buttons look like links

This commit is contained in:
SleeplessOne1917 2023-09-25 23:30:01 -04:00
parent 3ba232ea42
commit 6793e3768a
2 changed files with 13 additions and 6 deletions

View file

@ -13,6 +13,7 @@ interface SubscribeButtonProps {
onFollow: MouseEventHandler; onFollow: MouseEventHandler;
onUnFollow: MouseEventHandler; onUnFollow: MouseEventHandler;
loading?: boolean; loading?: boolean;
isLink?: boolean;
} }
export function SubscribeButton({ export function SubscribeButton({
@ -23,6 +24,7 @@ export function SubscribeButton({
onFollow, onFollow,
onUnFollow, onUnFollow,
loading = false, loading = false,
isLink = false,
}: SubscribeButtonProps) { }: SubscribeButtonProps) {
let i18key: NoOptionI18nKeys; let i18key: NoOptionI18nKeys;
@ -44,14 +46,19 @@ export function SubscribeButton({
} }
} }
const buttonClass = "btn d-block mb-2 w-100"; const buttonClass = classNames(
"btn",
isLink ? "btn-link d-inline-block" : "d-block mb-2 w-100",
);
if (!UserService.Instance.myUserInfo) { if (!UserService.Instance.myUserInfo) {
return ( return (
<> <>
<button <button
type="button" type="button"
className={classNames(buttonClass, "btn-secondary")} className={classNames(buttonClass, {
"btn-secondary": !isLink,
})}
data-bs-toggle="modal" data-bs-toggle="modal"
data-bs-target="#remoteFetchModal" data-bs-target="#remoteFetchModal"
> >
@ -65,10 +72,9 @@ export function SubscribeButton({
return ( return (
<button <button
type="button" type="button"
className={classNames( className={classNames(buttonClass, {
buttonClass, [`btn-${subscribed === "Pending" ? "warning" : "secondary"}`]: !isLink,
`btn-${subscribed === "Pending" ? "warning" : "secondary"}`, })}
)}
onClick={subscribed === "NotSubscribed" ? onFollow : onUnFollow} onClick={subscribed === "NotSubscribed" ? onFollow : onUnFollow}
> >
{loading ? ( {loading ? (

View file

@ -192,6 +192,7 @@ export class Communities extends Component<any, CommunitiesState> {
}, },
this.handleFollow, this.handleFollow,
)} )}
isLink
/> />
</td> </td>
</tr> </tr>