UNPKG

censa_front_end_library

Version:

React components library project for censa Design System

119 lines (98 loc) 2.29 kB
.Switch { display: inline-flex; position: relative; } .Switch--tiny { height: var(--spacing-2); width: var(--spacing-3); } .Switch--regular { /* height: var(--spacing-2); */ width: var(--spacing-4); height: 24px; } .Switch--large { height: var(--spacing-xl); width: var(--spacing-4); } .Switch-input { position: absolute; cursor: pointer; z-index: 10; opacity: 0; width: 100%; height: 100%; margin: 0; } .Switch-wrapper { display: flex; align-items: center; line-height: 100%; padding: var(--spacing-s); top: 0; left: 0; width: 100%; background-color: var(--secondary-light); transition: background 120ms ease; padding-right: 6px; } .Switch-input:focus ~ .Switch-wrapper { box-shadow: var(--shadow-spread) var(--secondary-shadow); background-color: var(--secondary-light); } .Switch-input:focus ~ .Switch-wrapper--checked { box-shadow: var(--shadow-spread) var(--primary-shadow); background-color: #2fa843; } .Switch-input:hover ~ .Switch-wrapper { background-color: #258636; } .Switch-input:hover ~ .Switch-wrapper--checked { background-color: #258636; } .Switch-input:active ~ .Switch-wrapper { background-color: #2fa843; } .Switch-input:active ~ .Switch-wrapper--checked { background-color: #2fa843; } .Switch-wrapper--tiny { border-radius: 10px; } .Switch-wrapper--regular { border-radius: 8px; } .Switch-wrapper--large { border-radius: 34px; } .Switch-wrapper:before { content: ''; height: 100%; width: 50%; background-color: var(--shadow-0); box-shadow: var(--shadow-m); border-radius: 30%; box-sizing: border-box; transition-duration: 80ms; } .Switch-wrapper--checked { background-color: #258636; transition: background 120ms ease; padding-left: 6px; padding-right: 2px !important; } .Switch-wrapper--checked:before { -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); transition-duration: 80ms; } .Switch--disabled { pointer-events: none; } .Switch-wrapper--disabled { background-color: var(--secondary-lighter); } .Switch-wrapper--checkedDisabled { background-color: #d5eeda; }