Files
zulip/web/styles/modal.css
opmkumar 1e99745023 todo_list: Add option for modal to create todo-lists.
A button has been introduced to launch a modal
for creating todo-lists directly from the compose box.

The modal features a form that, upon submission,
generates a message using the `/todo` syntax and the data
inputted in the form. Subsequently, the content of the compose box
is set to this message, which the user can then send.

This modal closely parallels the UI for adding a poll; therefore,
the poll and todo code has been shifted to a newly created
file named `widget_modal.ts`, and `poll_modal.ts` is now deprecated.

Co-authored-by: Sujal Shah <sujalshah28092004@gmail.com>

Fixes #29779.
2025-02-14 14:57:24 -08:00

653 lines
15 KiB
CSS

/* Styles for the Micromodal-based modals */
:root {
/* Exit buttons are sometimes Cancel, but sometimes
other "Nah, forget it" actions. */
--color-exit-button-text: hsl(0deg 0% 0%);
--color-exit-button-border: hsl(300deg 2% 11% / 30%);
--color-exit-button-background: hsl(226deg 1% 42% / 20%);
--color-exit-button-background-interactive: hsl(226deg 1% 42% / 27%);
}
.modal__overlay {
position: fixed;
inset: 0;
background: hsl(0deg 0% 0% / 60%);
display: flex;
justify-content: center;
align-items: center;
z-index: 105;
}
.modal__container {
display: flex;
flex-direction: column;
background-color: var(--color-background-modal);
max-width: calc(100% - 32px);
max-height: 96%;
width: 37.1428em; /* 520px at 14px em */
border-radius: 4px;
box-sizing: border-box;
}
.modal__header {
padding: 16px 16px 16px 24px;
display: grid;
/* 1.8em is the shortest round value for heading at which none of
the letters of the english alphabet get cut by overflow:hidden
at em = 20px
29px at 16px/1em = 1.8125 */
grid-template:
"heading close-button" 1.8em "heading ." auto / minmax(0, 1fr)
1.8125em;
grid-column-gap: 4px;
}
.modal__footer {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 20px 24px;
}
.modal__title {
grid-area: heading;
margin: 0;
/* 16 / 14 * 1.375 = 1.5714, from original 1.375rem */
font-size: 1.5714em;
font-weight: 600;
line-height: 1.25;
overflow: hidden;
word-wrap: break-word;
.stream-privacy-type-icon {
/* This pushes back on suspect styles
in app_components.css. A fuller fix
will require tracking down other
instances of this class. */
width: auto;
padding-right: 0;
}
/* help_link_widget margin for the fa-circle-o. */
.help_link_widget {
margin-left: 5px;
}
}
.modal__title:has(.stream-or-topic-reference) {
/* Reduce the font weight of headings that
include stream or topic references (e.g.,
topic move/rename modals). */
font-weight: 450;
.stream-or-topic-reference {
/* Make the stream or topic references
more prominent. */
font-weight: 600;
}
}
.user-profile-name-heading {
max-width: 80%;
display: flex;
align-items: center;
gap: 10px;
/* This line-height is to increase the vertical clickable areas on the icons. */
line-height: 1.2727em; /* 28px at 22px font-size at 14px em */
.user-profile-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-profile-manage-own-edit-button,
.user-profile-manage-others-edit-button,
.user-profile-manage-own-copy-link-button {
color: hsl(200deg 100% 50%);
cursor: pointer;
&:hover {
color: hsl(200deg 100% 25%);
}
}
}
.modal__close {
&::before {
content: "\2715";
}
background: transparent;
border: 0;
&:hover {
background: hsl(0deg 0% 90%);
}
}
.modal__content {
display: flex;
flex-direction: column;
/* 16px at 14px/1em */
font-size: 1.1429em;
overflow-y: auto;
padding: 2px 24px;
line-height: 1.5;
&.simplebar-scrollable-y + .modal__footer {
border-top: 1px solid hsl(0deg 0% 87%);
}
}
.modal__button {
/* We need the backup value for billing related html files where
this variable is not defined. */
font-size: var(--base-font-size-px, 14px);
padding: 8px 16px;
background-color: hsl(0deg 0% 90%);
border-radius: 4px;
border-width: 0;
cursor: pointer;
text-transform: none;
overflow: visible;
line-height: 1.15;
margin: 0;
will-change: transform;
backface-visibility: hidden;
transform: translateZ(0);
transition: transform 0.25s ease-out;
&:hover {
text-decoration: none;
}
&:disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
.modal__button:focus,
.modal__button:hover {
transform: scale(1.05);
/* The extremely subtle 1.05 scale can cause
a gap to appear between the outline and
button background color; this negative
offset preserves the scale effect, but also
covers any tiny gaps owing to subtle scaling. */
outline-offset: -1px;
}
.dialog_exit_button {
color: var(--color-exit-button-text);
background: var(--color-exit-button-background);
border: 1px solid var(--color-exit-button-border);
&:hover {
background: var(--color-exit-button-background-interactive);
}
}
.dialog_submit_button {
margin-left: 12px;
background-color: hsl(240deg 96% 68%);
color: hsl(0deg 0% 100%) !important;
}
#user-profile-modal .save-success {
vertical-align: top;
background-color: transparent;
border-radius: 4px;
margin-right: 10px;
color: hsl(156deg 30% 50%);
padding: 0.5rem 1rem;
line-height: 1.15;
&:not(:empty) {
border: 1px solid hsl(156deg 30% 50%);
}
}
#read_receipts_error,
#dialog_error {
margin-bottom: 10px;
}
#archive-stream-modal .notification_stream_archive_warning {
margin-bottom: 0;
}
#read_receipts_modal {
.modal__container {
width: 25.7142em; /* 360px at 14px em */
.modal__content {
/* When showing read receipts, we use simplebar
to make the list scrollable. It requires this to
be flex. */
display: flex;
/* Setting a minimum height prevents the loading indicator
appearing/disappearing from resizing the modal in the
common case that one is requesting read receipts for
direct messages. */
min-height: 120px;
/* Setting a maximum height is just for aesthetics; the modal looks
weird if its aspect ratio gets too stretched. */
max-height: 480px;
/* For the notification bot error, we want to keep the modal clean and small.
The 16px padding is intended to match the padding at the top of the modal. */
&.compact {
min-height: unset;
padding-bottom: 16px;
}
}
}
.modal__header {
padding-bottom: 0;
}
& hr {
margin: 10px 0;
}
.modal__content {
padding: 0 24px 8px;
}
.loading_indicator {
margin: auto;
}
.read_receipts_list {
margin-left: 0;
& li {
.read_receipts_user_avatar {
display: inline-block;
height: 1.25em; /* 20px at 16px font-size at 14px em */
width: 1.25em; /* 20px at 16px font-size at 14px em */
position: relative;
right: 8px;
border-radius: 4px;
}
margin: 2px 0;
list-style-type: none;
overflow-x: hidden;
padding-left: 10px;
white-space: nowrap;
text-overflow: ellipsis;
cursor: pointer;
line-height: 1.625em; /* 26px at 16px font-size at 14px em */
&:hover {
background-color: hsl(0deg 0% 0% / 5%);
}
&:active,
&:focus {
background-color: hsl(0deg 0% 0% / 10%);
outline: none;
}
}
}
}
.email_field {
margin-top: 10px;
.email_field_textarea {
width: 97%;
resize: vertical;
margin-bottom: 10px;
}
.border-top {
border-top: 1px solid hsl(300deg 2% 11% / 30%);
padding-top: 10px;
}
.email-body {
margin-left: 20px;
margin-top: 20px;
}
}
@keyframes mmfadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes mmfadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.micromodal {
display: none;
}
.micromodal.modal--opening,
.micromodal.modal--open {
display: block;
}
.micromodal[aria-hidden="true"] .modal__overlay {
animation: mmfadeOut 75ms cubic-bezier(0, 0, 0.2, 1);
}
.micromodal[aria-hidden="false"] .modal__overlay {
animation: mmfadeIn 120ms cubic-bezier(0, 0, 0.2, 1);
}
.micromodal[aria-hidden="true"] .modal__container {
animation: mmfadeOut 75ms cubic-bezier(0, 0, 0.2, 1);
}
.micromodal[aria-hidden="false"] .modal__container {
animation: mmfadeIn 120ms cubic-bezier(0, 0, 0.2, 1);
}
.micromodal .modal__container,
.micromodal .modal__overlay {
will-change: transform;
}
.modal__spinner .loading_indicator_spinner {
height: 16px;
& path {
fill: hsl(0deg 0% 100%);
}
}
.modal__spinner {
display: flex;
align-items: center;
justify-content: center;
}
.time-input-formatted-description {
font-style: italic;
opacity: 0.7;
}
#copy_email_address_modal {
width: 800px;
.inline {
display: inline;
}
.question-which-parts {
padding-bottom: 10px;
}
.stream-email-header {
font-size: 18px;
}
}
.modal_select {
width: var(--modal-input-width);
padding: 4px 25px 4px 6px;
color: hsl(0deg 0% 33%);
border-radius: 4px;
border: 1px solid hsl(0deg 0% 80%);
cursor: pointer;
background-color: hsl(0deg 0% 100%);
&:disabled {
cursor: not-allowed;
/* The background-color of select elements inside modal is different than the others in
settings pages, because the background of the modal is brighter than the setting page. */
background-color: hsl(0deg 0% 90%);
/* This is reset for other browsers to use Chrome's opacity. */
opacity: 0.7;
}
}
.modal-field-label {
margin-bottom: var(--margin-bottom-field-description);
/* Avoid having the clickable area extend to the full width of the containing element */
width: fit-content;
}
.modal__body,
.overlay-content {
.dropdown-widget-button,
.dropdown_widget_with_label_wrapper {
width: var(--modal-input-width);
}
}
.modal_password_input,
.modal_url_input,
.modal_text_input {
padding: 4px 6px;
color: hsl(0deg 0% 33%);
border-radius: 4px;
border: 1px solid hsl(0deg 0% 80%);
box-shadow: inset 0 1px 1px hsl(0deg 0% 0% / 7.5%);
transition:
border-color linear 0.2s,
box-shadow linear 0.2s;
margin-bottom: 10px;
/* subtract padding (6px each side) and border (1px each side) */
width: calc(var(--modal-input-width) - 14px);
&:focus {
border-color: hsl(206deg 80% 62% / 80%);
outline: 0;
box-shadow:
inset 0 1px 1px hsl(0deg 0% 0% / 7.5%),
0 0 8px hsl(206deg 80% 62% / 60%);
}
}
#create_bot_short_name {
/* A shorter dropdown width (~200px at 14px em)
to ensure the email all fits on one line. */
width: 14em;
}
#add-poll-modal,
#add-todo-modal {
/* this height allows 3-4 option rows
to fit in without need for scrolling */
height: 32.1428em; /* 450px / 14px em */
overflow: hidden;
.modal__content {
flex-grow: 1;
.simplebar-content {
box-sizing: border-box;
height: 100%;
}
}
#add-poll-form,
#add-todo-form {
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
.poll-label,
.todo-label {
font-weight: bold;
margin: 5px 0;
}
.poll-question-input-container,
.todo-title-input-container {
display: flex;
margin-bottom: 10px;
#poll-question-input,
#todo-title-input {
flex-grow: 1;
}
}
.poll-options-list,
.todo-options-list {
margin: 0;
height: 0;
overflow: auto;
flex-grow: 1;
.option-row {
list-style-type: none;
cursor: move;
margin-top: 10px;
padding: 0;
display: flex;
align-items: center;
gap: 10px;
.drag-icon {
color: hsl(0deg 0% 75%);
}
.poll-option-input {
/* Overwrite .modal_text_input margin to keep vertical centering. */
margin-bottom: 0;
flex-grow: 1;
}
.todo-input {
flex: 1 1 auto;
margin-bottom: 0;
max-width: 30%;
}
.todo-description-container {
flex: 1 1 auto;
display: flex;
.todo-description-input {
flex-grow: 1;
margin-bottom: 0;
}
}
}
.option-row:first-child {
margin-top: 0;
}
.option-row:last-child {
cursor: default;
.delete-option {
visibility: hidden;
}
.drag-icon {
visibility: hidden;
}
}
}
@media (max-width: $sm_min) {
.option-row {
.todo-input {
width: 100%;
min-width: 90px;
}
.todo-description-container {
.todo-description-input {
width: 100%;
min-width: 90px;
}
}
}
}
}
}
#introduce-zulip-view-modal {
i {
vertical-align: middle;
}
.keyboard-button {
color: var(--color-hotkey-hint);
font-size: 12px;
font-weight: 500;
padding: 2px 4px;
border-radius: 3px;
border: 1px solid var(--color-hotkey-hint);
}
}
#generate-integration-url-modal {
#integrations-event-container {
.integration-all-events-buttons {
display: flex;
gap: 10px;
margin: 5px 0 10px;
}
#integrations-event-options {
.integration-event-wrapper {
margin: 5px 0;
}
.integration-event-name {
word-break: break-all;
}
}
}
}
#invite_users_option_tabs_container {
margin-bottom: 20px;
}
#send_later_options {
.send_later_list {
margin: 0;
list-style: none;
.send_later_option {
display: flex;
padding: 3px 15px;
&:focus,
&:hover {
text-decoration: none;
background-color: hsl(0deg 0% 0% / 20%);
}
}
}
}
.dialog-widget-footer-minor-text {
font-size: smaller;
font-style: italic;
margin-right: auto;
}
#topic-summary-modal {
width: 45em;
}