Fixed subscribe buttons style
This commit is contained in:
parent
d83a257e32
commit
eb338d446e
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"...subscribing": "...subscribing",
|
"subscribing...": "subscribing...",
|
||||||
"About": "About",
|
"About": "About",
|
||||||
"About the project": "About the project",
|
"About the project": "About the project",
|
||||||
"Add a few topics so that the reader knows what your content is about and can find it on pages of topics that interest them. Topics can be swapped, the first topic becomes the title": "Add a few topics so that the reader knows what your content is about and can find it on pages of topics that interest them. Topics can be swapped, the first topic becomes the title",
|
"Add a few topics so that the reader knows what your content is about and can find it on pages of topics that interest them. Topics can be swapped, the first topic becomes the title": "Add a few topics so that the reader knows what your content is about and can find it on pages of topics that interest them. Topics can be swapped, the first topic becomes the title",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"...subscribing": "...подписываем",
|
"subscribing...": "Подписка...",
|
||||||
"A short introduction to keep the reader interested": "Добавьте вступление, чтобы заинтересовать читателя",
|
"A short introduction to keep the reader interested": "Добавьте вступление, чтобы заинтересовать читателя",
|
||||||
"About": "О себе",
|
"About": "О себе",
|
||||||
"About the project": "О проекте",
|
"About the project": "О проекте",
|
||||||
|
|
|
@ -81,9 +81,24 @@
|
||||||
padding: 6px !important;
|
padding: 6px !important;
|
||||||
min-width: 32px;
|
min-width: 32px;
|
||||||
width: unset;
|
width: unset;
|
||||||
|
|
||||||
&:hover img {
|
&:hover img {
|
||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.actionButtonLabel {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionButtonLabelHovered {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionButtonLabelHovered {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,22 @@ export const AuthorBadge = (props: Props) => {
|
||||||
if (props.iconButtons) {
|
if (props.iconButtons) {
|
||||||
return <Icon name="author-subscribe" />
|
return <Icon name="author-subscribe" />
|
||||||
}
|
}
|
||||||
return isSubscribing() ? t('...subscribing') : t('Subscribe')
|
return isSubscribing() ? t('subscribing...') : t('Subscribe')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const unsubscribeValue = () => {
|
||||||
|
if (props.iconButtons) {
|
||||||
|
return <Icon name="author-unsubscribe" />
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<span class={styles.actionButtonLabel}>{t('Following')}</span>
|
||||||
|
<span class={styles.actionButtonLabelHovered}>{t('Unfollow')}</span>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.AuthorBadge, { [styles.nameOnly]: props.nameOnly })}>
|
<div class={clsx(styles.AuthorBadge, { [styles.nameOnly]: props.nameOnly })}>
|
||||||
<Userpic
|
<Userpic
|
||||||
|
@ -112,7 +125,7 @@ export const AuthorBadge = (props: Props) => {
|
||||||
fallback={
|
fallback={
|
||||||
<Button
|
<Button
|
||||||
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
||||||
size="S"
|
size="M"
|
||||||
value={subscribeValue()}
|
value={subscribeValue()}
|
||||||
onClick={() => handleSubscribe(true)}
|
onClick={() => handleSubscribe(true)}
|
||||||
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
||||||
|
@ -121,8 +134,8 @@ export const AuthorBadge = (props: Props) => {
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
||||||
size="S"
|
size="M"
|
||||||
value={props.iconButtons ? <Icon name="author-unsubscribe" /> : t('Following')}
|
value={() => unsubscribeValue()}
|
||||||
onClick={() => handleSubscribe(false)}
|
onClick={() => handleSubscribe(false)}
|
||||||
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
||||||
/>
|
/>
|
||||||
|
@ -131,7 +144,7 @@ export const AuthorBadge = (props: Props) => {
|
||||||
<Show when={props.showMessageButton}>
|
<Show when={props.showMessageButton}>
|
||||||
<Button
|
<Button
|
||||||
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
||||||
size="S"
|
size="M"
|
||||||
value={props.iconButtons ? <Icon name="inbox-white" /> : t('Message')}
|
value={props.iconButtons ? <Icon name="inbox-white" /> : t('Message')}
|
||||||
onClick={initChat}
|
onClick={initChat}
|
||||||
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
class={clsx(styles.actionButton, { [styles.iconed]: props.iconButtons })}
|
||||||
|
|
|
@ -109,6 +109,12 @@
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttonWriteMessage {
|
||||||
|
border-radius: 0.8rem;
|
||||||
|
padding-bottom: 0.6rem;
|
||||||
|
padding-top: 0.6rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.authorDetails {
|
.authorDetails {
|
||||||
|
|
|
@ -98,7 +98,7 @@ export const AuthorCard = (props: Props) => {
|
||||||
|
|
||||||
const followButtonText = () => {
|
const followButtonText = () => {
|
||||||
if (isSubscribing()) {
|
if (isSubscribing()) {
|
||||||
return t('...subscribing')
|
return t('subscribing...')
|
||||||
}
|
}
|
||||||
return t(subscribed() ? 'Unfollow' : 'Follow')
|
return t(subscribed() ? 'Unfollow' : 'Follow')
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ export const AuthorCard = (props: Props) => {
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
value={t('Message')}
|
value={t('Message')}
|
||||||
onClick={initChat}
|
onClick={initChat}
|
||||||
class={styles.buttonSubscribe}
|
class={styles.buttonWriteMessage}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actionButton {
|
||||||
|
border-radius: 0.8rem !important;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
width: 9em;
|
||||||
|
}
|
||||||
|
|
||||||
.isSubscribing {
|
.isSubscribing {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { CheckButton } from '../_shared/CheckButton'
|
||||||
import { capitalize } from '../../utils/capitalize'
|
import { capitalize } from '../../utils/capitalize'
|
||||||
|
|
||||||
import styles from './Card.module.scss'
|
import styles from './Card.module.scss'
|
||||||
|
import { Button } from '../_shared/Button'
|
||||||
|
|
||||||
interface TopicProps {
|
interface TopicProps {
|
||||||
topic: Topic
|
topic: Topic
|
||||||
|
@ -62,6 +63,24 @@ export const TopicCard = (props: TopicProps) => {
|
||||||
}, 'subscribe')
|
}, 'subscribe')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const subscribeValue = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Show when={props.iconButton}>
|
||||||
|
<Show when={subscribed()} fallback="+">
|
||||||
|
<Icon name="check-subscribed" />
|
||||||
|
</Show>
|
||||||
|
</Show>
|
||||||
|
<Show when={!props.iconButton}>
|
||||||
|
<Show when={subscribed()} fallback={t('Follow')}>
|
||||||
|
<span class={styles.buttonUnfollowLabel}>{t('Unfollow')}</span>
|
||||||
|
<span class={styles.buttonSubscribedLabel}>{t('Following')}</span>
|
||||||
|
</Show>
|
||||||
|
</Show>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={styles.topicContainer}>
|
<div class={styles.topicContainer}>
|
||||||
<div
|
<div
|
||||||
|
@ -123,27 +142,17 @@ export const TopicCard = (props: TopicProps) => {
|
||||||
<CheckButton text={t('Follow')} checked={subscribed()} onClick={handleSubscribe} />
|
<CheckButton text={t('Follow')} checked={subscribed()} onClick={handleSubscribe} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<button
|
<Button
|
||||||
|
variant="bordered"
|
||||||
|
size="M"
|
||||||
|
value={subscribeValue()}
|
||||||
onClick={handleSubscribe}
|
onClick={handleSubscribe}
|
||||||
class="button--light button--subscribe-topic"
|
class={clsx(styles.actionButton, {
|
||||||
classList={{
|
|
||||||
[styles.isSubscribing]: isSubscribing(),
|
[styles.isSubscribing]: isSubscribing(),
|
||||||
[styles.isSubscribed]: subscribed()
|
[styles.isSubscribed]: subscribed()
|
||||||
}}
|
})}
|
||||||
disabled={isSubscribing()}
|
disabled={isSubscribing()}
|
||||||
>
|
/>
|
||||||
<Show when={props.iconButton}>
|
|
||||||
<Show when={subscribed()} fallback="+">
|
|
||||||
<Icon name="check-subscribed" />
|
|
||||||
</Show>
|
|
||||||
</Show>
|
|
||||||
<Show when={!props.iconButton}>
|
|
||||||
<Show when={subscribed()} fallback={t('Follow')}>
|
|
||||||
<span class={styles.buttonUnfollowLabel}>{t('Unfollow')}</span>
|
|
||||||
<span class={styles.buttonSubscribedLabel}>{t('Following')}</span>
|
|
||||||
</Show>
|
|
||||||
</Show>
|
|
||||||
</button>
|
|
||||||
</Show>
|
</Show>
|
||||||
</Show>
|
</Show>
|
||||||
</ShowOnlyOnClient>
|
</ShowOnlyOnClient>
|
||||||
|
|
|
@ -80,7 +80,7 @@ export const TopicBadge = (props: Props) => {
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
size="S"
|
size="S"
|
||||||
value={isSubscribing() ? t('...subscribing') : t('Subscribe')}
|
value={isSubscribing() ? t('subscribing...') : t('Subscribe')}
|
||||||
onClick={() => subscribe(true)}
|
onClick={() => subscribe(true)}
|
||||||
class={styles.subscribeButton}
|
class={styles.subscribeButton}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -44,7 +44,7 @@ export const Subscribe = (props: Props) => {
|
||||||
|
|
||||||
if (!validate()) return
|
if (!validate()) return
|
||||||
|
|
||||||
setTitle(t('...subscribing'))
|
setTitle(t('subscribing...'))
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -106,7 +106,7 @@ export const Subscribe = (props: Props) => {
|
||||||
<Icon name="arrow-right" />
|
<Icon name="arrow-right" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="description">Подпишитесь на рассылку лучших публикаций</div>
|
<div class="description">Подпишитесь на рассылку лучших публикаций</div>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={emailError()}>
|
<Show when={emailError()}>
|
||||||
<div class={styles.error}>{emailError()}</div>
|
<div class={styles.error}>{emailError()}</div>
|
||||||
|
|
|
@ -1036,3 +1036,7 @@ iframe {
|
||||||
.cursorPointer {
|
.cursorPointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.img-align-column {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user