@navelpluisje/pcb-components
Version:
A library with native components. They are all pcb components, like a dip-switch, resitor etc.
129 lines (116 loc) • 2.8 kB
CSS
.resistor {
--background: hsl(0, 0%, 100%);
--knob-size: 4rem;
background-image: linear-gradient(
90deg,
hsl(0, 0%, 85%) 65%,
hsl(0, 0%, 80%) 65%
);
background-position: left 1rem center;
background-repeat: repeat-y;
background-size: .3125rem 1px;
display: inline-block;
height: calc(var(--knob-size) * 1.5);
margin-bottom: 1rem;
position: relative;
width: var(--knob-size);
}
.resistor-heads {
height: 3rem;
left: 1.15rem;
position: relative;
top: 50%;
transform: translate(-50%, -50%);
width: 1.5rem;
}
.resistor-heads::before,
.resistor-heads::after {
background-color: hsl(38, 30%, 75%);
background-image: radial-gradient(
circle,
hsl(38, 30%, 75%) 65%,
hsl(38, 30%, 70%) 65%
);
background-position: right .25rem center;
background-size: 100% 100%;
border-radius: .25rem;
box-sizing: border-box;
content: '';
display: block;
height: .5rem;
left: 0;
position: absolute;
width: 100%;
}
.resistor-heads::before {
top: 0;
}
.resistor-heads::after {
bottom: 0;
}
.resistor-body {
background-color: hsl(38, 30%, 75%);
background-image: linear-gradient(
90deg,
hsl(38, 30%, 75%) 65%,
hsl(38, 30%, 70%) 65%
);
box-sizing: border-box;
display: flex;
flex-direction: column;
height: 2.2rem;
justify-content: space-around;
margin-left: .1rem;
position: relative;
top: .4rem;
width: 1.3rem;
z-index: 1;
}
.band {
background-color: green;
background-image: linear-gradient(
90deg,
hsla(0, 0%, 0%, 0) 65%,
hsla(0, 0%, 0%, .3) 65%
);
height: 10%;
}
.band:last-of-type {
background-color: hsl(46, 100%, 64%);
}
.band.color-0 { background-color: hsl(0, 0%, 10%); }
.band.color-1 { background-color: hsl(22, 50%, 25%); }
.band.color-2 { background-color: hsl(0, 50%, 50%); }
.band.color-3 { background-color: hsl(30, 50%, 50%); }
.band.color-4 { background-color: hsl(60, 80%, 60%); }
.band.color-5 { background-color: hsl(120, 50%, 50%); }
.band.color-6 { background-color: hsl(240, 50%, 50%); }
.band.color-7 { background-color: hsl(300, 50%, 50%); }
.band.color-8 { background-color: hsl(0, 0%, 50%); }
.band.color-9 { background-color: hsl(0, 0%, 100%); }
.band.color--1 { background-color: hsl(46, 100%, 64%); }
.band.color--2 { background-color: hsl(0, 0%, 80%); }
.value {
background-color: transparent;
border: none;
color: hsl(0, 0%, 30%);
font-weight: 600;
padding: .25rem;
font-family: monospace;
text-align: center;
transform: rotate(-90deg);
transform-origin: center;
transition: all .3s ease;
width: 100%;
}
.value::after {
content: '\2126';
}
.value:focus,
.resistor:focus .value,
.resistor.focus .value {
background-color: white;
border: 1px solid gray;
border-radius: .25rem;
transform: rotate(0deg);
}