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 {
color: var(--red-color);
}
meter.donut[hidden] {
display: inline-block;
visibility: hidden;
}
/* SHINY PILL */

View file

@ -30,8 +30,8 @@
#compose-container textarea {
width: 100%;
max-width: 100%;
height: 4em;
min-height: 4em;
height: 5em;
min-height: 5em;
max-height: 50vh;
resize: vertical;
line-height: 1.4;
@ -135,6 +135,9 @@
padding: 8px 0;
gap: 8px;
}
#compose-container .toolbar.wrap {
flex-wrap: wrap;
}
#compose-container .toolbar.stretch {
justify-content: stretch;
}
@ -145,7 +148,7 @@
#compose-container .toolbar-button {
display: inline-block;
color: var(--link-color);
background-color: var(--bg-blur-color);
background-color: transparent;
padding: 0 8px;
border-radius: 8px;
min-height: 2.4em;
@ -271,6 +274,19 @@
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 {
background-color: var(--bg-faded-color);
padding: 8px;

View file

@ -651,6 +651,7 @@ function Compose({
)}
<form
ref={formRef}
class={`form-visibility-${visibility}`}
style={{
pointerEvents: uiState === 'loading' ? 'none' : 'auto',
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">
<input
type="file"
@ -1036,9 +1042,13 @@ function Compose({
<Icon icon="poll" alt="Add poll" />
</button>{' '}
<div class="spacer" />
{uiState === 'loading' && <Loader abrupt />}{' '}
{uiState !== 'loading' && (
<CharCountMeter maxCharacters={maxCharacters} />
{uiState === 'loading' ? (
<Loader abrupt />
) : (
<CharCountMeter
maxCharacters={maxCharacters}
hidden={uiState === 'loading'}
/>
)}
<label
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 charCount = snapStates.composerCharacterCount;
const leftChars = maxCharacters - charCount;
if (charCount <= maxCharacters / 2) {
return null;
if (charCount <= maxCharacters / 2 || hidden) {
return <meter class="donut" hidden />;
}
return (
<meter