Simplify CSS by migrating to Flexbox

This commit is contained in:
Nikita Karamov 2023-03-20 20:13:06 +01:00
parent 1fbefa9fd3
commit 370d66c755
No known key found for this signature in database
GPG Key ID: 41D6F71EE78E77CD
1 changed files with 22 additions and 45 deletions

View File

@ -1,76 +1,53 @@
:root {
--button-size: 36px;
--icon-size: 20px;
--padding-ver: calc(0.3 * var(--icon-size));
--padding-hor: calc(var(--icon-size) / 2);
--padding-icon: calc((var(--button-size) - var(--icon-size)) / 2);
--height: calc(var(--button-size) - 2 * var(--padding-ver));
--width: calc(var(--button-size) - 2 * var(--padding-hor));
--shareon-size: 36px;
--shareon-icon-size: 20px;
--shareon-radius: 4px;
}
.shareon {
font-size: 0 !important;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 5px;
}
.shareon > * {
display: inline-block;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-evenly;
gap: calc((var(--shareon-size) - var(--shareon-icon-size)) / 2);
height: var(--height);
min-width: var(--width);
box-sizing: border-box;
height: var(--shareon-size);
min-width: var(--shareon-size);
padding: calc((var(--shareon-size) - var(--shareon-icon-size)) / 2);
margin: calc(var(--padding-ver) / 2);
padding: var(--padding-ver) var(--padding-hor);
border: none;
border-radius: var(--shareon-radius);
background-color: #333;
border-radius: calc(var(--icon-size) / 6);
border: none;
box-sizing: content-box;
color: white;
line-height: 1.5;
transition: opacity 300ms ease;
vertical-align: middle;
}
.shareon > *:hover {
border: none;
cursor: pointer;
opacity: 0.7;
}
.shareon > *:not(:empty) {
font-size: calc(0.8 * var(--icon-size));
font-size: calc(0.8 * var(--shareon-icon-size));
text-decoration: none;
}
.shareon > *:not(:empty)::before {
position: relative;
height: 100%;
width: calc(var(--icon-size) + var(--padding-icon));
top: 0;
left: 0;
background-position: 0 50%;
}
.shareon > *::before {
display: inline-block;
position: absolute;
height: var(--icon-size);
width: var(--icon-size);
top: var(--padding-icon);
left: var(--padding-icon);
height: var(--shareon-icon-size);
width: var(--shareon-icon-size);
background-repeat: no-repeat;
background-size: var(--icon-size) var(--icon-size);
background-size: contain;
content: "";
vertical-align: bottom;
}
.shareon > .copy-url:before {