Fix/hydration (#315)
hydration fix --------- Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
This commit is contained in:
parent
3f3bd798e6
commit
37a8805b8a
|
@ -64,18 +64,7 @@ export const AuthorBadge = (props: Props) => {
|
||||||
return isSubscribing() ? t('subscribing...') : t('Subscribe')
|
return isSubscribing() ? t('subscribing...') : t('Subscribe')
|
||||||
})
|
})
|
||||||
|
|
||||||
const unsubscribeValue = createMemo(() => {
|
const unsubscribeValue = () => {}
|
||||||
if (props.iconButtons) {
|
|
||||||
return <Icon name="author-unsubscribe" class={stylesButton.icon} />
|
|
||||||
}
|
|
||||||
|
|
||||||
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 })}>
|
||||||
|
@ -142,7 +131,19 @@ export const AuthorBadge = (props: Props) => {
|
||||||
<Button
|
<Button
|
||||||
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
variant={props.iconButtons ? 'secondary' : 'bordered'}
|
||||||
size="M"
|
size="M"
|
||||||
value={unsubscribeValue()}
|
value={
|
||||||
|
<Show
|
||||||
|
when={props.iconButtons}
|
||||||
|
fallback={
|
||||||
|
<>
|
||||||
|
<span class={styles.actionButtonLabel}>{t('Following')}</span>
|
||||||
|
<span class={styles.actionButtonLabelHovered}>{t('Unfollow')}</span>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon name="author-unsubscribe" class={stylesButton.icon} />
|
||||||
|
</Show>
|
||||||
|
}
|
||||||
onClick={() => handleSubscribe(false)}
|
onClick={() => handleSubscribe(false)}
|
||||||
isSubscribeButton={true}
|
isSubscribeButton={true}
|
||||||
class={clsx(styles.actionButton, {
|
class={clsx(styles.actionButton, {
|
||||||
|
|
|
@ -528,9 +528,8 @@ export const Header = (props: Props) => {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<ShowOnlyOnClient>
|
|
||||||
<Snackbar />
|
<Snackbar />
|
||||||
</ShowOnlyOnClient>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import styles from './Snackbar.module.scss'
|
||||||
import { Transition } from 'solid-transition-group'
|
import { Transition } from 'solid-transition-group'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { Icon } from '../_shared/Icon'
|
import { Icon } from '../_shared/Icon'
|
||||||
|
import { ShowOnlyOnClient } from '../_shared/ShowOnlyOnClient'
|
||||||
|
|
||||||
export const Snackbar = () => {
|
export const Snackbar = () => {
|
||||||
const { snackbarMessage } = useSnackbar()
|
const { snackbarMessage } = useSnackbar()
|
||||||
|
@ -15,6 +16,7 @@ export const Snackbar = () => {
|
||||||
[styles.success]: snackbarMessage()?.type === 'success'
|
[styles.success]: snackbarMessage()?.type === 'success'
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
<ShowOnlyOnClient>
|
||||||
<Transition
|
<Transition
|
||||||
enterClass={styles.enter}
|
enterClass={styles.enter}
|
||||||
exitToClass={styles.exitTo}
|
exitToClass={styles.exitTo}
|
||||||
|
@ -29,6 +31,7 @@ export const Snackbar = () => {
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
</ShowOnlyOnClient>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user