UNPKG

react-smart-tabs

Version:

A tab component with drag and drop functionality, add and close

177 lines (164 loc) 3.79 kB
@keyframes move-aside { 0% { transform: translateX(8%); } 100% { transform: translateX(0%); } } @keyframes move-before { 0% { transform: translateX(-8%); } 100% { transform: translateX(0%); } } body { margin: 0; } .close { display: flex; margin-left: auto; width: 16px; height: 16px; padding-bottom: 2px; text-align: center; justify-content: center; align-items: center; border-radius: 20%; transition: background 0.05s ease-in; } .close * { pointer-events: none; } .close * svg { height: 8px; width: 8px; } .close * svg * { fill: #fff; } .close .close-icon svg { height: 8px; width: 8px; } .close .close-icon svg * { fill: #fff; } .close:hover { background-color: #666; } .close:before { content: ""; display: block; width: 1px; height: 22px; background-color: #383838; position: absolute; right: 0px; top: 8px; z-index: 0; } .tab__bar { display: flex; flex-direction: row; background: transparent; padding-left: 10px; padding-right: 10px; padding-top: 5px; border-color: #383838; overflow: hidden; user-select: none; list-style-type: none; min-height: 40px; max-height: inherit; margin: 0; position: relative; } .tab__bar * { user-select: none; } .tab__bar li { display: flex; margin: 2px -1px 0px 0px; padding: 10px 10px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-left-radius: -30%; border-bottom-right-radius: -30%; text-align: left; position: relative; cursor: pointer; color: white; max-width: 145px; width: 170px; transition: background 0.15s ease-in; align-items: flex-start; } .tab__bar li.active:after { content: ""; position: absolute; bottom: -1px; right: -3px; border: 1px solid; border-color: inherit; border-top: 0; border-right: 0; border-bottom-left-radius: 5px; height: 3px; width: 3px; } .tab__bar li.active:before { content: ""; position: absolute; bottom: -1px; left: -3px; border: 1px solid; border-color: inherit; border-top: 0; border-left: 0; border-bottom-right-radius: 5px; height: 3px; width: 3px; } .tab__bar li:hover { background: #292929; } .tab__bar li:hover > .close:before { background: transparent; } .tab__bar li.active { background: #383838; border-color: inherit; width: 145px; z-index: 99; pointer-events: all; } .tab-panel { width: 100%; } .tab-panel:not(.active) { display: none; } .animated { animation: move-aside 0.12s ease-out; } .deanimated { animation: move-before 0.12s ease-out; } .addButton { color: white; cursor: pointer; padding-top: 6px; padding-right: 10px; } .bar__wrapper { display: flex; background: #222; height: 45px; width: 100%; margin: 0; align-items: center; border-bottom: 3px solid #383838; overflow: hidden; } .active { display: block; } .test-tabbar { display: flex; flex-direction: row; } .test-tabbar .tab-panel { background-color: #383838; } .test-tabbar .bar__wrapper { height: 500px; flex-direction: row; width: 55px; margin: 0; } .test-tabbar .bar__wrapper .tab__bar { padding: 0; display: flex; flex-direction: column; width: 100%; height: 100%; } .test-tabbar .bar__wrapper .tab__bar li { box-sizing: border-box; min-width: initial; max-width: initial; width: inherit; border-radius: 0; height: 55px; margin: 0; } .test-tabbar .bar__wrapper .tab-panel { width: 50%; }