UI adjustments to composer

This commit is contained in:
Lim Chee Aun 2023-03-24 01:26:49 +08:00
parent 11324364a5
commit 45e633de92
3 changed files with 40 additions and 10 deletions

View file

@ -1268,6 +1268,10 @@ meter.donut:is(.warning, .danger, .explode):after {
meter.donut:is(.danger, .explode):after { meter.donut:is(.danger, .explode):after {
color: var(--red-color); color: var(--red-color);
} }
meter.donut[hidden] {
display: inline-block;
visibility: hidden;
}
/* SHINY PILL */ /* SHINY PILL */

View file

@ -30,8 +30,8 @@
#compose-container textarea { #compose-container textarea {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
height: 4em; height: 5em;
min-height: 4em; min-height: 5em;
max-height: 50vh; max-height: 50vh;
resize: vertical; resize: vertical;
line-height: 1.4; line-height: 1.4;
@ -135,6 +135,9 @@
padding: 8px 0; padding: 8px 0;
gap: 8px; gap: 8px;
} }
#compose-container .toolbar.wrap {
flex-wrap: wrap;
}
#compose-container .toolbar.stretch { #compose-container .toolbar.stretch {
justify-content: stretch; justify-content: stretch;
} }
@ -145,7 +148,7 @@
#compose-container .toolbar-button { #compose-container .toolbar-button {
display: inline-block; display: inline-block;
color: var(--link-color); color: var(--link-color);
background-color: var(--bg-blur-color); background-color: transparent;
padding: 0 8px; padding: 0 8px;
border-radius: 8px; border-radius: 8px;
min-height: 2.4em; min-height: 2.4em;
@ -271,6 +274,19 @@
background-color: var(--bg-color); background-color: var(--bg-color);
} }
#compose-container .form-visibility-direct {
--yellow-stripes: repeating-linear-gradient(
-45deg,
var(--reply-to-faded-color),
var(--reply-to-faded-color) 10px,
var(--reply-to-faded-color) 10px,
transparent 10px,
transparent 20px
);
/* diagonal stripes of yellow */
background-image: var(--yellow-stripes);
}
#compose-container .media-attachments { #compose-container .media-attachments {
background-color: var(--bg-faded-color); background-color: var(--bg-faded-color);
padding: 8px; padding: 8px;

View file

@ -651,6 +651,7 @@ function Compose({
)} )}
<form <form
ref={formRef} ref={formRef}
class={`form-visibility-${visibility}`}
style={{ style={{
pointerEvents: uiState === 'loading' ? 'none' : 'auto', pointerEvents: uiState === 'loading' ? 'none' : 'auto',
opacity: uiState === 'loading' ? 0.5 : 1, opacity: uiState === 'loading' ? 0.5 : 1,
@ -975,7 +976,12 @@ function Compose({
}} }}
/> />
)} )}
<div class="toolbar"> <div
class="toolbar wrap"
style={{
justifyContent: 'flex-end',
}}
>
<label class="toolbar-button"> <label class="toolbar-button">
<input <input
type="file" type="file"
@ -1036,9 +1042,13 @@ function Compose({
<Icon icon="poll" alt="Add poll" /> <Icon icon="poll" alt="Add poll" />
</button>{' '} </button>{' '}
<div class="spacer" /> <div class="spacer" />
{uiState === 'loading' && <Loader abrupt />}{' '} {uiState === 'loading' ? (
{uiState !== 'loading' && ( <Loader abrupt />
<CharCountMeter maxCharacters={maxCharacters} /> ) : (
<CharCountMeter
maxCharacters={maxCharacters}
hidden={uiState === 'loading'}
/>
)} )}
<label <label
class={`toolbar-button ${ class={`toolbar-button ${
@ -1292,12 +1302,12 @@ const Textarea = forwardRef((props, ref) => {
); );
}); });
function CharCountMeter({ maxCharacters = 500 }) { function CharCountMeter({ maxCharacters = 500, hidden }) {
const snapStates = useSnapshot(states); const snapStates = useSnapshot(states);
const charCount = snapStates.composerCharacterCount; const charCount = snapStates.composerCharacterCount;
const leftChars = maxCharacters - charCount; const leftChars = maxCharacters - charCount;
if (charCount <= maxCharacters / 2) { if (charCount <= maxCharacters / 2 || hidden) {
return null; return <meter class="donut" hidden />;
} }
return ( return (
<meter <meter