ticket-selector
Version:
A professional stadium seat selection widget with multi-language support
502 lines (495 loc) • 11.3 kB
CSS
.ticket-select {
display: flex;
flex-direction: column;
position: relative;
width: 100%;
height: 100%;
flex-grow: 1;
}
.ticket-select:not(.is-loaded) .ticket-select__stadium {
display: none ;
}
.ticket-select:not(.is-loaded) .ticket-select__loading {
display: flex ;
}
.ticket-select.is-loaded .ticket-select__loading {
display: none ;
}
.ticket-select__container {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background: transparent;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.ticket-select__wrapper {
width: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
}
.ticket-select__viewport {
width: 100%;
flex-grow: 1;
position: relative;
overflow: hidden;
cursor: grab;
background-color: #fff;
}
.ticket-select__viewport:active {
cursor: grabbing;
}
.ticket-select__viewport--seats-view {
background-color: #f1f1f1;
}
.ticket-select__content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform-origin: 0 0;
display: flex;
flex-direction: column;
justify-content: center;
}
.ticket-select__stadium {
position: relative;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
max-width: 100%;
max-height: 100%;
}
.ticket-select__stadium-image {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
display: block;
object-fit: contain;
}
.ticket-select__stadium-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ticket-select__stadium-svg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.ticket-select__sector {
transition: fill-opacity 0.3s ease, stroke 0.3s ease;
cursor: pointer;
fill-opacity: 0.6;
stroke-width: 2;
stroke: #fff;
}
.ticket-select__sector:hover:not(.ticket-select__sector--disabled) {
stroke-width: 3;
filter: brightness(1.1);
}
.ticket-select__sector[data-sector-color=yellow] {
fill: #f8ad02;
}
.ticket-select__sector[data-sector-color=yellow]:hover {
fill: rgb(197.408, 137.708, 1.592);
}
.ticket-select__sector[data-sector-color=red] {
fill: #bb2932;
}
.ticket-select__sector[data-sector-color=red]:hover {
fill: rgb(145.1710526316, 31.8289473684, 38.8157894737);
}
.ticket-select__sector[data-sector-color=blue] {
fill: #2175bf;
}
.ticket-select__sector[data-sector-color=blue]:hover {
fill: rgb(25.4866071429, 90.3616071429, 147.5133928571);
}
.ticket-select__sector[data-sector-color=dark-blue] {
fill: #274180;
}
.ticket-select__sector[data-sector-color=dark-blue]:hover {
fill: rgb(27.0898203593, 45.1497005988, 88.9101796407);
}
.ticket-select__sector[data-sector-color=green] {
fill: #0c8d4b;
}
.ticket-select__sector[data-sector-color=green]:hover {
fill: #085e32;
}
.ticket-select__sector-green.ticket-select__seat--selected path {
fill: #0a2e88 ;
}
.ticket-select__sector[data-sector-color=purple] {
fill: #77169e;
}
.ticket-select__sector[data-sector-color=purple]:hover {
fill: rgb(85.2833333333, 15.7666666667, 113.2333333333);
}
.ticket-select__sector--disabled {
fill: #494b4a ;
fill-opacity: 1 ;
cursor: not-allowed;
}
.ticket-select__seats-header {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
}
.ticket-select__sector-title {
margin: 0;
font-size: 16px;
color: #333;
font-weight: 600;
text-align: center;
background: rgba(255, 255, 255, 0.9);
padding: 10px 20px;
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.ticket-select__seats-title {
margin: 0;
font-size: 16px;
color: #333;
font-weight: 600;
text-align: center;
background: rgba(255, 255, 255, 0.9);
padding: 10px 20px;
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.ticket-select__seats-svg {
background: #f1f1f1;
}
.ticket-select__seats-background {
fill: #f1f1f1;
}
.ticket-select__seats-step {
fill: #e5e6e6;
}
.ticket-select__seats-row-label {
font-family: "Roboto-Regular", Roboto, sans-serif;
font-size: 12px;
fill: #666;
text-anchor: middle;
pointer-events: none;
}
.ticket-select__seat {
cursor: pointer;
transition: all 0.2s ease;
}
.ticket-select__seat:hover {
filter: brightness(1.2);
}
.ticket-select__seat--selected path {
fill: #0a8837 ;
}
.ticket-select__seat--unavailable {
cursor: not-allowed;
}
.ticket-select__seat--unavailable:hover {
filter: none;
}
.ticket-select__seat--unavailable path {
fill: #999 ;
}
.ticket-select__seat--available path {
fill: #b3bc31;
}
.ticket-select__seat path {
transition: fill 0.2s ease;
stroke: #000;
stroke-miterlimit: 10;
stroke-width: 0.25px;
}
.ticket-select__seat circle {
fill: #fff;
pointer-events: none;
}
.ticket-select__seat text {
pointer-events: none;
font-family: "Roboto-Regular", Roboto, sans-serif;
fill: #000;
font-weight: 500;
}
.ticket-select__seat--color-yellow path {
fill: #f8ad02;
}
.ticket-select__seat--color-yellow path:hover {
fill: rgb(197.408, 137.708, 1.592);
}
.ticket-select__seat--color-red path {
fill: #bb2932;
}
.ticket-select__seat--color-red path:hover {
fill: rgb(145.1710526316, 31.8289473684, 38.8157894737);
}
.ticket-select__seat--color-blue path {
fill: #2175bf;
}
.ticket-select__seat--color-blue path:hover {
fill: rgb(25.4866071429, 90.3616071429, 147.5133928571);
}
.ticket-select__seat--color-dark-blue path {
fill: #274180;
}
.ticket-select__seat--color-dark-blue path:hover {
fill: rgb(27.0898203593, 45.1497005988, 88.9101796407);
}
.ticket-select__seat--color-green path {
fill: #0c8d4b;
}
.ticket-select__seat--color-green path:hover {
fill: #085e32;
}
.ticket-select__seat--color-green.ticket-select__seat--selected path {
fill: #0a2e88 ;
}
.ticket-select__seat--color-purple path {
fill: #77169e;
}
.ticket-select__seat--color-purple path:hover {
fill: rgb(85.2833333333, 15.7666666667, 113.2333333333);
}
.ticket-select__controls {
position: absolute;
top: 20px;
right: 20px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 100;
}
.ticket-select__control-btn {
width: 40px;
height: 40px;
border: none;
background: rgba(255, 255, 255, 0.9);
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.ticket-select__control-btn svg {
display: inline-flex;
vertical-align: -0.015em;
width: 1em;
height: 1em;
fill: currentColor;
stroke: none;
}
.ticket-select__control-btn:hover {
background: rgb(255, 255, 255);
transform: scale(1.05);
}
.ticket-select__control-btn:active {
transform: scale(0.95);
}
.ticket-select__control-btn--back {
background: #999;
color: #fff;
}
.ticket-select__control-btn--back:hover {
background: rgb(127.5, 127.5, 127.5);
}
.ticket-select__info {
height: 60px;
background: #fff;
border-top: 1px solid #ddd;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
z-index: 99;
flex-shrink: 0;
}
.ticket-select__info-btn {
display: flex;
outline: none;
border: 0;
border-radius: 10px;
background-color: #f8ad02;
font-weight: bold;
color: #000;
font-size: 16px;
padding: 8px 20px;
min-height: 40px;
min-width: 120px;
transition: 0.2s all;
cursor: pointer;
text-decoration: none;
align-items: center;
justify-content: center;
}
@media (max-width: 768px) {
.ticket-select__info-btn {
min-height: 40px;
}
}
.ticket-select__info-btn [data-ticket-selector-count] {
margin-left: 4px;
}
.ticket-select__info-btn--active {
display: inline-flex;
}
.ticket-select__info-btn[disabled] {
opacity: 0.6;
cursor: not-allowed;
pointer-events: none;
}
.ticket-select__info-btn:hover:not([disabled]) {
background-color: rgb(253.2464, 187.4864, 37.5536);
}
.ticket-select__selected-count {
font-size: 16px;
color: #666;
font-weight: 500;
}
.ticket-select__loading {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 18px;
color: #333;
flex-direction: column;
gap: 20px;
}
.ticket-select__loader {
width: 40px;
height: 40px;
}
.ticket-select__loader svg {
width: 100%;
height: 100%;
animation: ticket-select-spin 1s linear infinite;
}
.ticket-select__loading-text {
font-size: 16px;
color: #666;
}
@keyframes ticket-select-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@media (max-width: 768px) {
.ticket-select__controls {
top: 10px;
right: 10px;
}
.ticket-select__control-btn {
width: 35px;
height: 35px;
font-size: 18px;
}
.ticket-select__info {
padding: 0 15px;
}
.ticket-select__selected-count {
font-size: 14px;
}
}
@media (max-width: 480px) {
.ticket-select__control-btn {
width: 30px;
height: 30px;
font-size: 16px;
}
}
:fullscreen,
:-webkit-full-screen,
:-moz-full-screen,
:-ms-fullscreen {
background: #ddd ;
}
:fullscreen .ticket-select,
:-webkit-full-screen .ticket-select,
:-moz-full-screen .ticket-select,
:-ms-fullscreen .ticket-select {
background: #ddd ;
width: 100vw ;
height: 100vh ;
}
:fullscreen .ticket-select__container,
:-webkit-full-screen .ticket-select__container,
:-moz-full-screen .ticket-select__container,
:-ms-fullscreen .ticket-select__container {
background: #ddd ;
width: 100vw ;
height: 100vh ;
}
:fullscreen .ticket-select__wrapper,
:-webkit-full-screen .ticket-select__wrapper,
:-moz-full-screen .ticket-select__wrapper,
:-ms-fullscreen .ticket-select__wrapper {
background: #ddd ;
width: 100vw ;
height: 100vh ;
}
:fullscreen .ticket-select__viewport,
:-webkit-full-screen .ticket-select__viewport,
:-moz-full-screen .ticket-select__viewport,
:-ms-fullscreen .ticket-select__viewport {
background: #f1f1f1 ;
}
:fullscreen .ticket-select__content,
:-webkit-full-screen .ticket-select__content,
:-moz-full-screen .ticket-select__content,
:-ms-fullscreen .ticket-select__content {
background: transparent;
}
:fullscreen .ticket-select__stadium,
:-webkit-full-screen .ticket-select__stadium,
:-moz-full-screen .ticket-select__stadium,
:-ms-fullscreen .ticket-select__stadium {
background: transparent;
}
.ticket-select:fullscreen,
.ticket-select:-webkit-full-screen,
.ticket-select:-moz-full-screen,
.ticket-select:-ms-fullscreen {
background: #ddd ;
width: 100vw ;
height: 100vh ;
margin: 0 ;
padding: 0 ;
}
:fullscreen .wrapper,
:-webkit-full-screen .wrapper,
:-moz-full-screen .wrapper,
:-ms-fullscreen .wrapper {
background: #ddd ;
width: 100vw ;
height: 100vh ;
}
:fullscreen .ticket-select__stadium-image,
:-webkit-full-screen .ticket-select__stadium-image,
:-moz-full-screen .ticket-select__stadium-image,
:-ms-fullscreen .ticket-select__stadium-image {
background: transparent;
}
/*# sourceMappingURL=ticket-selector.css.map */