mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-30 01:21:36 +01:00
Button text swapper for Unfollow button
This commit is contained in:
parent
6b41666efe
commit
f1ca52d561
2 changed files with 36 additions and 2 deletions
src
|
@ -190,7 +190,8 @@ function Account({ account }) {
|
||||||
{relationshipUIState !== 'loading' && relationship && (
|
{relationshipUIState !== 'loading' && relationship && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class={`${following ? 'light danger' : ''}`}
|
class={`${following ? 'light' : ''} swap`}
|
||||||
|
data-swap-state="danger"
|
||||||
disabled={relationshipUIState === 'loading'}
|
disabled={relationshipUIState === 'loading'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRelationshipUIState('loading');
|
setRelationshipUIState('loading');
|
||||||
|
@ -218,7 +219,15 @@ function Account({ account }) {
|
||||||
})();
|
})();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{following ? 'Unfollow…' : 'Follow'}
|
{following ? (
|
||||||
|
<>
|
||||||
|
<span>Following</span>
|
||||||
|
<span>Unfollow…</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
'Follow'
|
||||||
|
)}
|
||||||
|
{/* {following ? 'Unfollow…' : 'Follow'} */}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -172,6 +172,31 @@ button,
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:is(button, .button).swap {
|
||||||
|
display: grid;
|
||||||
|
/* 1 column, 1 row */
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
}
|
||||||
|
:is(button, .button).swap > * {
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
|
transition: opacity 0.3s;
|
||||||
|
}
|
||||||
|
:is(button, .button).swap > *:nth-child(2) {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
:is(button, .button).swap:hover > *:nth-child(2) {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
:is(button, .button).swap[data-swap-state='danger']:hover {
|
||||||
|
color: var(--red-color);
|
||||||
|
border-color: var(--red-color);
|
||||||
|
}
|
||||||
|
:is(button, .button).swap:hover > *:nth-child(1) {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
input[type='text'],
|
input[type='text'],
|
||||||
textarea,
|
textarea,
|
||||||
select {
|
select {
|
||||||
|
|
Loading…
Add table
Reference in a new issue