refactor: using CSS variables instead of ::part() selector
This commit is contained in:
sairaj mote 2021-02-13 02:38:43 +05:30
parent 971c5dc5b3
commit ad51bba083
6 changed files with 1242 additions and 1076 deletions

File diff suppressed because one or more lines are too long

View File

@ -177,9 +177,7 @@ strong {
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 1; z-index: 1;
} --padding: 0.9rem 1.6rem;
.fab::part(button) {
padding: 0.9rem 1.6rem;
} }
.fab .icon { .fab .icon {
margin-left: 0 !important; margin-left: 0 !important;
@ -236,9 +234,10 @@ span.ripple {
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
} }
sm-popup sm-input::part(input) { sm-input {
border-radius: 0.5rem; --border-radius: 0.5rem;
} }
sm-popup sm-input + sm-input { sm-popup sm-input + sm-input {
margin-top: 1rem; margin-top: 1rem;
} }
@ -449,9 +448,7 @@ sm-button.danger {
} }
#sign_in sm-button { #sign_in sm-button {
width: 100%; width: 100%;
} --padding: 0.8rem 1.6rem;
#sign_in sm-button::part(button) {
padding: 0.8rem 1.6rem;
} }
#sign_in p { #sign_in p {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
@ -553,7 +550,7 @@ sm-button.danger {
transform: scale(1); transform: scale(1);
} }
} }
#main { #main_page {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
@ -940,7 +937,6 @@ sm-button.danger {
background: rgba(var(--foreground-color), 1); background: rgba(var(--foreground-color), 1);
} }
#main_navbar .logo-section { #main_navbar .logo-section {
margin: 1rem 0 1.5rem 0;
padding: 0 1rem; padding: 0 1rem;
} }
#main_navbar .active { #main_navbar .active {
@ -1109,10 +1105,7 @@ sm-button.danger {
#contacts .header sm-input, #mails .header sm-input, #settings_page .header sm-input { #contacts .header sm-input, #mails .header sm-input, #settings_page .header sm-input {
margin: 0; margin: 0;
width: 100%; width: 100%;
} --padding: 0.5rem 1rem;
#contacts .header sm-input::part(input), #mails .header sm-input::part(input), #settings_page .header sm-input::part(input) {
border-radius: 0.5rem;
padding: 0.5rem 1rem;
} }
#contacts .header h4, #mails .header h4, #settings_page .header h4 { #contacts .header h4, #mails .header h4, #settings_page .header h4 {
text-transform: capitalize; text-transform: capitalize;
@ -1513,6 +1506,9 @@ sm-button.danger {
justify-content: center; justify-content: center;
font-size: 2.6rem; font-size: 2.6rem;
} }
.big-emoji .text-emoji {
font-size: 2.6rem !important;
}
#chat_middle { #chat_middle {
flex: 1; flex: 1;
@ -1780,6 +1776,8 @@ sm-panel {
bottom: 0; bottom: 0;
right: 0; right: 0;
border-radius: 1rem; border-radius: 1rem;
border: solid;
margin: 1.5rem;
} }
#call_controls { #call_controls {
@ -1788,6 +1786,21 @@ sm-panel {
justify-self: center; justify-self: center;
} }
#pick_up_call {
color: #00C853;
}
.circular-button {
align-items: center;
--padding: 0;
--border-radius: 50%;
}
.circular-button .filled {
height: 3rem;
width: 3rem;
padding: 1rem;
}
@media screen and (max-width: 640px) { @media screen and (max-width: 640px) {
.hide-on-mobile { .hide-on-mobile {
position: fixed; position: fixed;
@ -1957,7 +1970,7 @@ sm-panel {
min-width: 36rem; min-width: 36rem;
} }
#main { #main_page {
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
} }

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -147,9 +147,7 @@ strong{
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 1; z-index: 1;
&::part(button){ --padding: 0.9rem 1.6rem;
padding: 0.9rem 1.6rem;
}
.icon{ .icon{
margin-left: 0 !important; margin-left: 0 !important;
margin-right: 0.5rem; margin-right: 0.5rem;
@ -198,10 +196,10 @@ span.ripple{
cursor: pointer; cursor: pointer;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
} }
sm-input{
--border-radius: 0.5rem;
}
sm-popup{ sm-popup{
sm-input::part(input){
border-radius: 0.5rem;
}
sm-input + sm-input{ sm-input + sm-input{
margin-top: 1rem; margin-top: 1rem;
} }
@ -397,9 +395,7 @@ sm-button.danger{
} }
sm-button{ sm-button{
width: 100%; width: 100%;
&::part(button){ --padding: 0.8rem 1.6rem;
padding: 0.8rem 1.6rem;
}
} }
p { p {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
@ -499,7 +495,7 @@ sm-button.danger{
transform: scale(1); transform: scale(1);
} }
} }
#main{ #main_page{
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
@ -870,7 +866,6 @@ sm-button.danger{
width: max(16rem, 60vw); width: max(16rem, 60vw);
background: rgba(var(--foreground-color), 1); background: rgba(var(--foreground-color), 1);
.logo-section{ .logo-section{
margin: 1rem 0 1.5rem 0;
padding: 0 1rem; padding: 0 1rem;
} }
.active{ .active{
@ -1035,10 +1030,7 @@ sm-button.danger{
sm-input{ sm-input{
margin: 0; margin: 0;
width: 100%; width: 100%;
} --padding: 0.5rem 1rem;
sm-input::part(input){
border-radius: 0.5rem;
padding: 0.5rem 1rem;
} }
h4{ h4{
text-transform: capitalize; text-transform: capitalize;
@ -1423,6 +1415,9 @@ sm-button.danger{
justify-content: center; justify-content: center;
font-size: 2.6rem; font-size: 2.6rem;
} }
.text-emoji{
font-size: 2.6rem !important;
}
} }
#chat_middle{ #chat_middle{
flex: 1; flex: 1;
@ -1681,12 +1676,27 @@ sm-panel{
bottom: 0; bottom: 0;
right: 0; right: 0;
border-radius: 1rem; border-radius: 1rem;
border: solid;
margin: 1.5rem;
} }
#call_controls{ #call_controls{
padding: 1.5rem; padding: 1.5rem;
margin-top: auto; margin-top: auto;
justify-self: center; justify-self: center;
} }
#pick_up_call{
color: #00C853;
}
.circular-button{
align-items: center;
.filled{
height: 3rem;
width: 3rem;
padding: 1rem;
}
--padding: 0;
--border-radius: 50%;
}
@media screen and (max-width: 640px){ @media screen and (max-width: 640px){
.hide-on-mobile{ .hide-on-mobile{
position: fixed; position: fixed;
@ -1839,7 +1849,7 @@ sm-panel{
#reply_mail_popup::part(popup){ #reply_mail_popup::part(popup){
min-width: 36rem; min-width: 36rem;
} }
#main{ #main_page{
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
} }
#emoji_picker{ #emoji_picker{

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,9 @@ smButton.innerHTML = `
display: -webkit-inline-box; display: -webkit-inline-box;
display: -ms-inline-flexbox; display: -ms-inline-flexbox;
display: inline-flex; display: inline-flex;
--padding: 0.6rem 1.2rem;
--border-radius: 0.3rem;
--background: rgba(var(--text-color), 0.1);
} }
:host([disable]) .button{ :host([disable]) .button{
cursor: not-allowed; cursor: not-allowed;
@ -45,13 +48,13 @@ smButton.innerHTML = `
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
width: 100%; width: 100%;
padding: 0.6rem 1.2rem; padding: var(--padding);
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
border-radius: 0.3rem; border-radius: var(--border-radius);
-webkit-box-pack: center; -webkit-box-pack: center;
-ms-flex-pack: center; -ms-flex-pack: center;
justify-content: center; justify-content: center;
@ -63,17 +66,11 @@ smButton.innerHTML = `
text-transform: capitalize; text-transform: capitalize;
font-size: 0.9rem; font-size: 0.9rem;
font-weight: 500; font-weight: 500;
background: rgba(var(--text-color), 0.1); background: var(--background);
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
outline: none; outline: none;
overflow: hidden; overflow: hidden;
} }
span.ripple {
position: absolute;
border-radius: 50%;
transform: scale(0);
background: rgba(var(--text-color), 0.2);
}
:host(:not([disable])) .button:focus-visible{ :host(:not([disable])) .button:focus-visible{
-webkit-box-shadow: 0 0 0 0.1rem var(--accent-color); -webkit-box-shadow: 0 0 0 0.1rem var(--accent-color);
box-shadow: 0 0 0 0.1rem var(--accent-color); box-shadow: 0 0 0 0.1rem var(--accent-color);
@ -199,6 +196,8 @@ border: none;
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
--border-radius: 0.3rem;
--padding: 0.7rem 1rem;
} }
.hide{ .hide{
opacity: 0 !important; opacity: 0 !important;
@ -236,8 +235,8 @@ border: none;
align-items: center; align-items: center;
position: relative; position: relative;
gap: 0.5rem; gap: 0.5rem;
padding: 0.7rem 1rem; padding: var(--padding);
border-radius: 0.3rem; border-radius: var(--border-radius);
-webkit-transition: opacity 0.3s; -webkit-transition: opacity 0.3s;
-o-transition: opacity 0.3s; -o-transition: opacity 0.3s;
transition: opacity 0.3s; transition: opacity 0.3s;
@ -578,6 +577,7 @@ smTextarea.innerHTML = `
} }
:host{ :host{
display: grid; display: grid;
--border-radius: 0.3s;
} }
:host(.outlined) .textarea { :host(.outlined) .textarea {
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 0.4) inset; box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 0.4) inset;
@ -594,7 +594,7 @@ smTextarea.innerHTML = `
align-items: stretch; align-items: stretch;
max-height: 8rem; max-height: 8rem;
background: rgba(var(--text-color), 0.06); background: rgba(var(--text-color), 0.06);
border-radius: 0.3rem; border-radius: var(--border-radius);
} }
.textarea::after, .textarea::after,
textarea{ textarea{