UNPKG

grudus-timepicker

Version:

Material design time picker in pure Javascript without any dependencies

166 lines (142 loc) 2.67 kB
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes fade-out { from { opacity: 1; } to { opacity: 0; } } .g-time-wrapper { box-sizing: content-box; min-width: 300px; min-height: 450px; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: 'Roboto', sans-serif; display: flex; flex-direction: column; justify-content: flex-start; } .g-flex { flex-grow: 1; } .g-head { flex-grow: 1; display: flex; justify-content: center; align-items: center; } .g-head-content { font-size: 3em; display: flex; } .g-current { margin: 0 2px; } .g-clock-wrapper { flex-grow: 4; display: flex; align-items: center; justify-content: center; } .g-clock { position: relative; border-radius: 100%; height: 240px; width: 240px; cursor: default; } .g-clock.g-clock-inner { top: 50%; left: 50%; transform: translate(-50%, -50%); height: 160px; width: 160px; } .g-clock-item { position: absolute; border-radius: 100%; width: 20px; height: 20px; text-align: center; padding: 10px; user-select: none; cursor: default; font-size: 1.1em; z-index: 3; } .g-clock-item.g-clock-inner { font-size: 0.9em; z-index: 3; } .g-clock-outer { position: absolute; width: 4px; height: 4px; border: 18px solid #1976D2; background: whitesmoke; color: whitesmoke; border-radius: 100%; visibility: hidden; z-index: 2; } .g-clock-outer.g-selected { visibility: visible; } .g-middle-dot { z-index: 2; position: absolute; width: 1px; height: 1px; padding: 7px; border-radius: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%); } .g-hand-of-a-clock { position: absolute; z-index: 2; top: 50%; left: 50%; transform: translateY(-50%); transform-origin: left center; height: 3px; width: 20px; } .g-buttons { display: flex; justify-content: flex-end; align-items: center; flex-grow: 0.5; } .g-button { font-weight: 600; border: none; background: transparent; margin-right: 16px; padding: 8px; } .g-button:hover { cursor: pointer; background: #CFD8DC; } .g-fade-in { animation: fade-in 0.4s; } .g-fade-out { animation: fade-out 0.4s; } .g-pointer:hover { cursor: pointer; }