Skip to content

Commit

Permalink
refactor: split up css into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
vyneer committed Apr 29, 2023
1 parent 313b7ce commit 4f89e8a
Show file tree
Hide file tree
Showing 23 changed files with 2,028 additions and 1,869 deletions.
71 changes: 71 additions & 0 deletions assets/chat/css/autocomplete.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#chat.chat-autocomplete-in {
.chat-scroll-notify {
display: none !important;
}
#chat-input-control {
border-radius: 0 0 $bradius $bradius;
}
}

#chat:not(.pref-autocompletehelper) {
#chat-auto-complete {
display: none !important;
}
}

/* Auto complete */
#chat-auto-complete {
pointer-events: none;
transition: opacity 750ms;
transition-timing-function: cubic-bezier(0, 0.74, 0.1, 0.99);
opacity: 0;
z-index: 131;
border-radius: $bradius $bradius 0 0;
position: absolute;
font-size: 1.1em;
line-height: 2em;
height: 2em;
top: -2em;
left: 0;
right: 0;
overflow: hidden;
white-space: nowrap;

&.active {
opacity: 1;
pointer-events: auto;
}

ul {
position: absolute;
white-space: nowrap;
list-style: none;
padding: 0;
margin: 0;
}

li {
padding: 0 $gutter-sm;
cursor: pointer;
text-decoration: none;
display: inline-block;
color: $color-chat-text3;
background: rgba($color-surface-dark1, 0.75);

&:first-child {
border-radius: $bradius 0 0 0;
}

&:last-child {
border-radius: 0 $bradius 0 0;
}

&:hover {
color: lighten($color-chat-text3, 20);
}

&.active {
color: $text-color;
}
}
}
305 changes: 305 additions & 0 deletions assets/chat/css/chat.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
#chat {
min-width: $chat-min-width;
display: flex;
flex-direction: column;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}

#chat-output-frame {
flex: 1;
overflow: hidden;
width: 100%;
}

#chat-input-frame {
padding: $gutter-md $gutter-md 0 $gutter-md;
}

#chat-input-wrap {
position: relative;
}

@keyframes whisper-pulse {
2% {
opacity: 1;
transform: scale(1.3);
}
}

#chat-tools-wrap {
display: flex;
position: relative;
user-select: none;

.chat-tools-group {
display: flex;

&:first-child {
flex: 1;
}
}

.chat-tool-btn {
width: 2.25em;
height: 2.25em;
cursor: pointer;
color: $color-chat-disabled;
position: relative;
text-decoration: none;
display: inline-block;
border: 0.35em solid transparent; /* used for "padding" */

.btn-icon {
opacity: 0.25;
transition: opacity 150ms;
width: 100%;
height: 100%;
display: inline-block;

@at-root #chat-emoticon-btn .btn-icon {
background: transparent url('../img/icon-emotes.svg') no-repeat center
center;
background-size: contain;
}

@at-root #chat-whisper-btn .btn-icon {
background: transparent url('../img/icon-whispers.svg') no-repeat center
center;
background-size: contain;
}

@at-root #chat-settings-btn .btn-icon {
background: transparent url('../img/icon-settings.svg') no-repeat center
center;
background-size: contain;
}

@at-root #chat-users-btn .btn-icon {
background: transparent url('../img/icon-users.svg') no-repeat center
center;
background-size: contain;
}
}

&.ping .btn-icon {
animation: whisper-pulse 1.5s ease-in-out;
}

&:hover,
&.active {
.btn-icon {
opacity: 1;
}
}
}
}

#chat-input-control {
max-height: 140px;
position: relative;
color: $color-chat-text2;
background: $color-surface-dark2;
border: 1px solid $color-surface-dark3;
outline: none;
resize: none;
margin: 0;
width: 100%;
padding: $gutter-md;
border-radius: $bradius;
box-shadow: none;
box-sizing: border-box;
display: block;
overflow: hidden;

&::placeholder {
color: $color-chat-place;
}
}

#chat-input-subonly {
cursor: default;
display: none;
position: absolute;
top: $gutter-md;
right: $gutter-sm;
width: 1.5em;
height: 1.5em;

.btn-icon {
display: inline-block;
opacity: 0.75;
transition: opacity 150ms;
width: 100%;
height: 100%;
background: transparent url('../img/icon-subonly.svg') no-repeat center
center;
background-size: contain;

&:hover {
opacity: 1;
}
}
}

/* Window selector */
#chat-windows-select {
padding-top: 0.5em;
background: $color-surface-dark4;
white-space: nowrap;
display: flex;
z-index: 100;

.tab {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
border-radius: $bradius $bradius 0 0;
color: $color-chat-text3;
user-select: none;
cursor: pointer;
font-size: 1em;
padding: $gutter-sm $gutter-lg;

&:hover,
&.unread {
color: $color-chat-text1;
}

&.active {
color: $color-chat-text1;
background: $color-surface-dark1;
margin-left: 0;
margin-right: 0;
overflow: visible;
text-overflow: unset;
min-width: auto;
display: flex;
align-items: center;
.tab-close {
display: inline-block;
}
}
}

.tab-close {
background: transparent url('../img/icon-close.svg') no-repeat center center;
background-size: contain;
width: 1em;
height: 1em;
opacity: 0.25;
margin-left: $gutter-md;
display: none;
&:hover {
opacity: 1;
}
}

.win-main {
width: 3em;
flex-shrink: 0;

.tab-close {
display: none !important;
}

span {
display: none;
}

.dgg-icon {
background: transparent url('../img/dgg-icon.svg') no-repeat center center;
background-size: contain;
display: block;
width: 100%;
height: 100%;
}
}
}

/* Login screen */
#chat-login-screen {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba($color-surface-dark1, 0.75);
position: absolute;
text-align: center;
top: 0;
left: 0;
right: 0;
bottom: 0;

h2 {
font-size: 2.5em;
font-weight: normal;
margin: 0;
}

p {
margin: 1em 0 1.5em 0;
}
}

/* Loading screen */
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

#chat-loading {
opacity: 0.2;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;

.chat-loading-icon {
width: 4em;
height: 4em;
display: inline-block;
animation: spin 2s linear infinite;
background: transparent url('../img/icon-settings.svg') no-repeat center
center;
background-size: contain;
}
}

button.btn {
display: inline-block;
padding: $gutter-md $gutter-lg;
margin-bottom: 0;
font-weight: normal;
text-align: center;
white-space: nowrap;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: $bradius;
}

.btn-primary {
color: $text-color;
background-color: $color-accent;
border-color: $color-accent;
}

.btn-default {
color: $text-color3;
background-color: $color-surface-light1;
border-color: $color-surface-light3;
}
11 changes: 11 additions & 0 deletions assets/common.scss → assets/chat/css/common.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
$chat-chrome-font: 'Roboto', Helvetica, 'Trebuchet MS', Verdana, sans-serif;
$chat-lines-font: 'Roboto', Helvetica, 'Trebuchet MS', Verdana, sans-serif;
$chat-min-width: 300px;

$gutter-xs: 0.2em;
$gutter-sm: 0.3em;
$gutter-md: 0.6em;
$gutter-lg: 0.9em;

$bradius: 0.25em;

$color-light: #fff7f9;
$color-dark: #201f1e;
$color-accent: #4a8ecc;
Expand Down
Loading

0 comments on commit 4f89e8a

Please sign in to comment.