Fixed subscribe button style

This commit is contained in:
kvakazyambra 2023-11-08 23:52:56 +03:00
parent 2e30aaa594
commit 98e0777d2e
5 changed files with 33 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import { clsx } from 'clsx' import { clsx } from 'clsx'
import styles from './AuthorBadge.module.scss' import styles from './AuthorBadge.module.scss'
import stylesButton from '../../_shared/Button/Button.module.scss'
import { Userpic } from '../Userpic' import { Userpic } from '../Userpic'
import { Author, FollowingEntity } from '../../../graphql/types.gen' import { Author, FollowingEntity } from '../../../graphql/types.gen'
import { createMemo, createSignal, Match, Show, Switch } from 'solid-js' import { createMemo, createSignal, Match, Show, Switch } from 'solid-js'
@ -131,7 +132,10 @@ export const AuthorBadge = (props: Props) => {
value={subscribeValue()} value={subscribeValue()}
onClick={() => handleSubscribe(true)} onClick={() => handleSubscribe(true)}
isSubscribeButton={true} isSubscribeButton={true}
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })} class={clsx(styles.actionButton, {
[styles.iconed]: props.iconButtons,
[stylesButton.subscribed]: subscribed()
})}
/> />
} }
> >
@ -141,7 +145,10 @@ export const AuthorBadge = (props: Props) => {
value={unsubscribeValue()} value={unsubscribeValue()}
onClick={() => handleSubscribe(false)} onClick={() => handleSubscribe(false)}
isSubscribeButton={true} isSubscribeButton={true}
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })} class={clsx(styles.actionButton, {
[styles.iconed]: props.iconButtons,
[stylesButton.subscribed]: subscribed()
})}
/> />
</Show> </Show>
</Show> </Show>

View File

@ -211,7 +211,14 @@ export const AuthorCard = (props: Props) => {
when={isProfileOwner()} when={isProfileOwner()}
fallback={ fallback={
<div class={styles.authorActions}> <div class={styles.authorActions}>
<Button onClick={handleSubscribe} value={followButtonText()} isSubscribeButton={true} /> <Button
onClick={handleSubscribe}
value={followButtonText()}
isSubscribeButton={true}
class={{
[stylesButton.subscribed]: subscribed()
}}
/>
<Button <Button
variant={'secondary'} variant={'secondary'}
value={t('Message')} value={t('Message')}

View File

@ -127,6 +127,7 @@
opacity: 0.5; opacity: 0.5;
} }
/*
.isSubscribed { .isSubscribed {
background: #000; background: #000;
color: #fff; color: #fff;
@ -153,6 +154,7 @@
display: none; display: none;
} }
} }
*/
.cardMode { .cardMode {
margin-bottom: 0; margin-bottom: 0;

View File

@ -14,6 +14,7 @@ import { capitalize } from '../../utils/capitalize'
import styles from './Card.module.scss' import styles from './Card.module.scss'
import { Button } from '../_shared/Button' import { Button } from '../_shared/Button'
import stylesButton from '../_shared/Button/Button.module.scss'
interface TopicProps { interface TopicProps {
topic: Topic topic: Topic
@ -73,8 +74,8 @@ export const TopicCard = (props: TopicProps) => {
</Show> </Show>
<Show when={!props.iconButton}> <Show when={!props.iconButton}>
<Show when={subscribed()} fallback={t('Follow')}> <Show when={subscribed()} fallback={t('Follow')}>
<span class={styles.buttonUnfollowLabel}>{t('Unfollow')}</span> <span class={stylesButton.buttonSubscribeLabelHovered}>{t('Unfollow')}</span>
<span class={styles.buttonSubscribedLabel}>{t('Following')}</span> <span class={stylesButton.buttonSubscribeLabel}>{t('Following')}</span>
</Show> </Show>
</Show> </Show>
</> </>
@ -150,7 +151,7 @@ export const TopicCard = (props: TopicProps) => {
isSubscribeButton={true} isSubscribeButton={true}
class={clsx(styles.actionButton, { class={clsx(styles.actionButton, {
[styles.isSubscribing]: isSubscribing(), [styles.isSubscribing]: isSubscribing(),
[styles.isSubscribed]: subscribed() [stylesButton.subscribed]: subscribed()
})} })}
disabled={isSubscribing()} disabled={isSubscribing()}
/> />

View File

@ -176,4 +176,14 @@
vertical-align: text-top; vertical-align: text-top;
} }
} }
&.subscribed {
background: #fff;
color: #000;
&:hover {
background: #000;
color: #fff;
}
}
} }