netbox.scss 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. // Netbox-specific Styles and Overrides.
  2. @use 'sass:map';
  3. @import './sidenav.scss';
  4. :root {
  5. --nbx-sidebar-bg: #{$gray-200};
  6. --nbx-sidebar-scroll: #{$gray-500};
  7. --nbx-sidebar-link-color: #{$gray-800};
  8. --nbx-sidebar-link-hover-bg: #{$blue-100};
  9. --nbx-sidebar-title-color: #{$text-muted};
  10. --nbx-sidebar-shadow: inset 0px -25px 20px -25px rgba(0, 0, 0, 0.25);
  11. --nbx-breadcrumb-bg: #{$light};
  12. --nbx-body-bg: #{$white};
  13. --nbx-body-color: #{$gray-800};
  14. --nbx-pre-bg: #{$gray-100};
  15. --nbx-pre-border-color: #{$gray-600};
  16. --nbx-change-added: #{rgba($green, 0.4)};
  17. --nbx-change-removed: #{rgba($red, 0.4)};
  18. --nbx-cable-node-bg: #{$gray-100};
  19. --nbx-cable-node-border-color: #{$gray-200};
  20. --nbx-cable-termination-bg: #{$gray-200};
  21. --nbx-cable-termination-border-color: #{$gray-300};
  22. --nbx-search-filter-border-left-color: #{$gray-300};
  23. --nbx-color-mode-toggle-color: #{$primary};
  24. --nbx-sidenav-pin-color: #{$orange};
  25. --nbx-sidenav-parent-color: #{$gray-900};
  26. &[data-netbox-color-mode='dark'] {
  27. --nbx-sidebar-bg: #{$gray-900};
  28. --nbx-sidebar-scroll: #{$gray-700};
  29. --nbx-sidebar-link-color: #{$gray-100};
  30. --nbx-sidebar-link-hover-bg: #{rgba($blue-300, 0.15)};
  31. --nbx-sidebar-title-color: #{$gray-600};
  32. --nbx-sidebar-shadow: inset 0px -25px 20px -25px rgba(255, 255, 255, 0.05);
  33. --nbx-breadcrumb-bg: #{$gray-800};
  34. --nbx-body-bg: #{$darker};
  35. --nbx-body-color: #{$gray-100};
  36. --nbx-pre-bg: #{$gray-700};
  37. --nbx-pre-border-color: #{$gray-600};
  38. --nbx-change-added: #{rgba($green-300, 0.4)};
  39. --nbx-change-removed: #{rgba($red-300, 0.4)};
  40. --nbx-cable-node-bg: #{$gray-700};
  41. --nbx-cable-node-border-color: #{$gray-600};
  42. --nbx-cable-termination-bg: #{$gray-800};
  43. --nbx-cable-termination-border-color: #{$gray-700};
  44. --nbx-search-filter-border-left-color: #{$gray-600};
  45. --nbx-color-mode-toggle-color: #{$yellow-300};
  46. --nbx-sidenav-pin-color: #{$yellow};
  47. --nbx-sidenav-parent-color: #{$gray-100};
  48. }
  49. }
  50. * {
  51. transition: background-color, color 0.1s ease-in-out;
  52. }
  53. .mw-25 {
  54. max-width: 25% !important;
  55. }
  56. .mw-33 {
  57. max-width: 33.33% !important;
  58. }
  59. .mw-50 {
  60. max-width: 50% !important;
  61. }
  62. .mw-66 {
  63. max-width: 66.66% !important;
  64. }
  65. .mw-75 {
  66. max-width: 75% !important;
  67. }
  68. .text-xs {
  69. font-size: $font-size-xs;
  70. line-height: $line-height-sm;
  71. }
  72. .opacity-0 {
  73. opacity: 0 !important;
  74. }
  75. .opacity-25 {
  76. opacity: 0.25 !important;
  77. }
  78. .opacity-50 {
  79. opacity: 0.5 !important;
  80. }
  81. .opacity-75 {
  82. opacity: 0.75 !important;
  83. }
  84. .opacity-100 {
  85. opacity: 1 !important;
  86. }
  87. // Force <small/> elements to make text smaller.
  88. small {
  89. font-size: smaller !important;
  90. }
  91. // Automatically space out adjacent columns.
  92. .col:not(:last-child):not(:only-child) {
  93. margin-bottom: $spacer;
  94. }
  95. // Ensure elements with data-href set show the correct cursor.
  96. // data-href is set on non non-anchor elements that need to redirect the user to a URL when
  97. // clicked, but where an anchor element does not suffice or is not supported.
  98. *[data-href] {
  99. cursor: pointer;
  100. }
  101. @each $color, $value in $theme-colors {
  102. // Override CSS values on each theme color.
  103. // Use Bootstrap's method of coloring alert links to appropriately color close buttons within
  104. // another colored element.
  105. // See: https://github.com/twbs/bootstrap/blob/2bdbb42dcf6bfb99b5e9e5444d9e64589eb8c08f/scss/_alert.scss#L50-L52
  106. // See: https://github.com/twbs/bootstrap/blob/2bdbb42dcf6bfb99b5e9e5444d9e64589eb8c08f/scss/_close.scss#L12
  107. $shifted-bg: shift-color($value, $alert-bg-scale);
  108. $shifted-color: shift-color($value, $alert-color-scale);
  109. @if (contrast-ratio($shifted-bg, $shifted-color) < $min-contrast-ratio) {
  110. $shifted-color: mix($value, color-contrast($shifted-bg), abs($alert-color-scale));
  111. }
  112. $btn-close-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$shifted-color}'><path d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/></svg>");
  113. .bg-#{$color} button.btn-close {
  114. background: transparent escape-svg($btn-close-bg) center / $btn-close-width auto no-repeat;
  115. }
  116. .btn.btn-ghost-#{$color} {
  117. color: $value;
  118. &:hover {
  119. background-color: rgba($value, 0.12);
  120. }
  121. }
  122. // Use Bootstrap's method of coloring the .alert-link class automatically.
  123. // See: https://github.com/twbs/bootstrap/blob/2bdbb42dcf6bfb99b5e9e5444d9e64589eb8c08f/scss/_alert.scss#L50-L52
  124. .alert.alert-#{$color},
  125. .table-#{$color} {
  126. // Exclude buttons.
  127. a:not(.btn) {
  128. font-weight: $font-weight-bold;
  129. color: $shifted-color;
  130. }
  131. // Apply a border to buttons contained within colored elements, if they're not already a
  132. // bordered button class.
  133. .btn:not([class*='btn-outline']) {
  134. border-color: $gray-700;
  135. }
  136. }
  137. // Toasts required a slightly different approach because the background color isn't "shifted",
  138. // it's the direct theme color.
  139. .toast.bg-#{$color} {
  140. $shifted-color: shift-color($value, $alert-color-scale);
  141. @if (contrast-ratio($value, $shifted-color) < $min-contrast-ratio) {
  142. $shifted-color: mix($value, color-contrast($value), abs($alert-color-scale));
  143. }
  144. a:not(.btn) {
  145. font-weight: $font-weight-bold;
  146. color: $shifted-color;
  147. }
  148. }
  149. // Use proper contrasting color foreground color for special components.
  150. .badge,
  151. .toast,
  152. .toast-header,
  153. .progress-bar {
  154. &.bg-#{$color} {
  155. color: color-contrast($value);
  156. }
  157. }
  158. // Use proper foreground color in the alert body. Note: this is applied to p, & small because
  159. // we *don't* want to override the h1-h6 colors for alerts, since those are set to a color
  160. // similar to the alert color.
  161. .alert.alert-#{$color} {
  162. p,
  163. small {
  164. color: color-contrast($value);
  165. }
  166. }
  167. }
  168. // Fix the hideous way Safari shows button anchor elements.
  169. a[type='button'] {
  170. -webkit-appearance: unset !important;
  171. }
  172. // Ensure progress bars (utilization graph) in tables aren't too narrow to display the percentage.
  173. table td > .progress {
  174. min-width: 6rem;
  175. }
  176. .nav-mobile {
  177. display: none;
  178. flex-direction: column;
  179. align-items: center;
  180. justify-content: space-between;
  181. width: 100%;
  182. @include media-breakpoint-down(lg) {
  183. display: flex;
  184. }
  185. .nav-mobile-top {
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. width: 100%;
  190. }
  191. }
  192. .search-container {
  193. display: flex;
  194. width: 100%;
  195. @include media-breakpoint-down(lg) {
  196. display: none;
  197. }
  198. }
  199. .card > .table.table-flush {
  200. margin-bottom: 0;
  201. overflow: hidden;
  202. border-bottom-right-radius: $card-border-radius;
  203. border-bottom-left-radius: $card-border-radius;
  204. thead th[scope='col'] {
  205. background-color: $table-flush-header-bg;
  206. vertical-align: middle;
  207. text-transform: uppercase;
  208. padding-top: map.get($spacers, 3);
  209. padding-bottom: map.get($spacers, 3);
  210. border-bottom-color: $card-border-color;
  211. border-top: 1px solid $card-border-color;
  212. }
  213. th,
  214. td {
  215. border-left: 0;
  216. border-right: 0;
  217. padding-left: map.get($spacers, 4) !important;
  218. padding-right: map.get($spacers, 4) !important;
  219. }
  220. tr[class] {
  221. border-color: $card-border-color !important;
  222. &:last-of-type {
  223. border-bottom-color: transparent !important;
  224. border-bottom-right-radius: $card-border-radius;
  225. border-bottom-left-radius: $card-border-radius;
  226. }
  227. }
  228. }
  229. // Primarily used for the new release notification, but could be used for other alerts as needed.
  230. // Wrap any alerts in .header-alert-container to ensure the layout is consistent.
  231. .header-alert-container {
  232. // Center-align the alert(s).
  233. display: flex;
  234. justify-content: center;
  235. align-items: center;
  236. // Apply the same spacing that's applied to the #content div's first child (.px-3).
  237. padding: 0 $spacer;
  238. // By default, alerts inside .header-alert-container should take up the full width.
  239. .alert {
  240. width: 100%;
  241. // Adjust the max-width for larger screens so there's not a big ugly blue blob taking up the
  242. // entire screen.
  243. @include media-breakpoint-up(md) {
  244. max-width: 75%;
  245. }
  246. @include media-breakpoint-up(lg) {
  247. max-width: 50%;
  248. }
  249. }
  250. }
  251. span.profile-button .dropdown-menu {
  252. transition: opacity 0.2s ease-in-out;
  253. display: block !important;
  254. right: 0;
  255. left: auto;
  256. margin-top: 0.5rem;
  257. box-shadow: $box-shadow;
  258. &:not(.show) {
  259. opacity: 0;
  260. pointer-events: none;
  261. }
  262. &.show {
  263. opacity: 1;
  264. pointer-events: auto;
  265. }
  266. }
  267. div#advanced-search-content {
  268. &.collapsing {
  269. transition: height 0.1s ease-in-out;
  270. }
  271. div.card div.card-body div.col:not(:last-child) {
  272. margin-right: 1rem;
  273. }
  274. }
  275. body {
  276. background-color: var(--nbx-body-bg);
  277. color: var(--nbx-body-color);
  278. g#netbox-logo-1 {
  279. fill: #9cc8f8;
  280. stroke: #9cc8f8;
  281. }
  282. g#netbox-logo-2 {
  283. fill: #1685fc;
  284. stroke: #1685fc;
  285. }
  286. &[data-netbox-color-mode='light'] {
  287. .btn.btn-primary,
  288. .progress-bar.bg-primary,
  289. .badge.bg-primary,
  290. .nav.nav-pills .nav-item.nav-link.active,
  291. .nav.nav-pills .nav-item .nav-link.active,
  292. .nav.nav-pills .nav-item .show > .nav-link {
  293. color: $gray-100;
  294. }
  295. }
  296. &[data-netbox-color-mode='dark'] {
  297. & {
  298. .btn.btn-primary,
  299. .progress-bar.bg-primary,
  300. .badge.bg-primary,
  301. .nav.nav-pills .nav-item.nav-link.active,
  302. .nav.nav-pills .nav-item .nav-link.active,
  303. .nav.nav-pills .nav-item .show > .nav-link {
  304. color: $black;
  305. }
  306. }
  307. .card table caption {
  308. color: $gray-300;
  309. }
  310. .breadcrumb .breadcrumb-item > a {
  311. color: $blue-200;
  312. &:hover {
  313. color: $blue-100;
  314. }
  315. }
  316. .card,
  317. .sidebar {
  318. .text-muted {
  319. color: $gray-400 !important;
  320. }
  321. }
  322. .text-body[class] {
  323. color: var(--nbx-body-color) !important;
  324. }
  325. g#netbox-logo-1 {
  326. fill: $white;
  327. stroke: $white;
  328. }
  329. g#netbox-logo-2 {
  330. fill: $gray-200;
  331. stroke: $gray-200;
  332. }
  333. }
  334. & table,
  335. &[data-netbox-color-mode] table {
  336. a {
  337. text-decoration: none;
  338. &:hover {
  339. text-decoration: underline;
  340. }
  341. }
  342. &.table > :not(caption) > * > * {
  343. padding-left: $table-cell-padding-x-sm !important;
  344. padding-right: $table-cell-padding-x-sm !important;
  345. }
  346. td,
  347. th {
  348. font-size: $font-size-sm;
  349. line-height: $line-height-sm;
  350. vertical-align: middle;
  351. &.min-width {
  352. width: 1%;
  353. }
  354. & input.form-check-input {
  355. // Ensure checkboxes aren't too small inside object tables.
  356. font-size: $font-size-base;
  357. margin-top: 0.125em;
  358. }
  359. & .btn-sm {
  360. line-height: $line-height-xs;
  361. }
  362. }
  363. &.object-list {
  364. th {
  365. font-size: $font-size-xs;
  366. line-height: $line-height-xs;
  367. vertical-align: bottom;
  368. }
  369. }
  370. &.attr-table {
  371. th {
  372. width: 25%;
  373. }
  374. }
  375. }
  376. }
  377. div.title-container {
  378. display: flex;
  379. justify-content: space-between;
  380. flex-wrap: wrap;
  381. div#content-title {
  382. display: flex;
  383. flex-direction: column;
  384. flex: 1 0 auto;
  385. padding-bottom: map.get($spacers, 2);
  386. }
  387. }
  388. nav.search {
  389. background-color: var(--nbx-body-bg);
  390. // Don't overtake dropdowns
  391. z-index: 999;
  392. justify-content: center;
  393. form button.dropdown-toggle {
  394. border-color: $input-border-color;
  395. font-weight: $input-group-addon-font-weight;
  396. line-height: $input-line-height;
  397. color: $input-group-addon-color;
  398. background-color: $input-group-addon-bg;
  399. border: $input-border-width solid $input-group-addon-border-color;
  400. @include border-radius($input-border-radius);
  401. border-left: 1px solid var(--nbx-search-filter-border-left-color);
  402. &:focus {
  403. box-shadow: unset !important;
  404. }
  405. }
  406. }
  407. main.layout {
  408. display: flex;
  409. flex-wrap: nowrap;
  410. height: 100vh;
  411. height: -webkit-fill-available;
  412. max-height: 100vh;
  413. overflow-x: auto;
  414. overflow-y: hidden;
  415. }
  416. main.login-container {
  417. display: flex;
  418. height: calc(100vh - 4rem);
  419. width: 100%;
  420. max-width: 100vw;
  421. align-items: center;
  422. justify-content: center;
  423. flex-direction: column;
  424. padding-top: 40px;
  425. padding-bottom: 40px;
  426. & + footer.footer button.color-mode-toggle {
  427. color: var(--nbx-color-mode-toggle-color);
  428. }
  429. }
  430. .footer {
  431. padding-top: map.get($spacers, 4);
  432. padding-right: 0;
  433. padding-bottom: map.get($spacers, 3);
  434. padding-left: 0;
  435. @include media-breakpoint-down(md) {
  436. // Pad the bottom of the footer on mobile devices to account for mobile browser controls.
  437. margin-bottom: 8rem;
  438. }
  439. }
  440. footer.login-footer {
  441. height: 4rem;
  442. margin-top: auto;
  443. .container-fluid {
  444. display: flex;
  445. justify-content: flex-end;
  446. padding: $container-padding-x $grid-gutter-width;
  447. }
  448. }
  449. h1 {
  450. font-weight: $font-weight-bolder;
  451. }
  452. h2 {
  453. font-weight: $font-weight-bold;
  454. }
  455. h3,
  456. h4 {
  457. font-weight: $font-weight-medium;
  458. }
  459. h5,
  460. h6 {
  461. font-weight: $font-weight-medium;
  462. }
  463. h1.accordion-item-title,
  464. h2.accordion-item-title,
  465. h3.accordion-item-title,
  466. h4.accordion-item-title,
  467. h5.accordion-item-title,
  468. h6.accordion-item-title {
  469. padding: 0.25rem 0.5rem;
  470. font-weight: $font-weight-bold;
  471. text-transform: uppercase;
  472. color: var(--nbx-sidebar-title-color);
  473. font-size: $font-size-sm;
  474. }
  475. .form-login {
  476. width: 100%;
  477. max-width: 330px;
  478. padding: 15px;
  479. & input:focus {
  480. z-index: 1;
  481. }
  482. }
  483. .form-login input[type='text'] {
  484. margin-bottom: -1px;
  485. border-bottom-left-radius: 0;
  486. border-bottom-right-radius: 0;
  487. }
  488. .form-login input[type='password'] {
  489. margin-bottom: 10px;
  490. border-top-left-radius: 0;
  491. border-top-right-radius: 0;
  492. }
  493. .form-login .form-control {
  494. position: relative;
  495. box-sizing: border-box;
  496. height: auto;
  497. padding: 10px;
  498. font-size: 16px;
  499. }
  500. li.dropdown-item.dropdown-item-btns {
  501. display: flex;
  502. justify-content: space-between;
  503. align-items: center;
  504. }
  505. .sidebar-sticky {
  506. position: relative;
  507. top: 0;
  508. height: calc(100vh - 48px);
  509. padding-top: 0.5rem;
  510. overflow-x: hidden;
  511. overflow-y: auto; // Scrollable contents if viewport is shorter than content.
  512. }
  513. .navbar-brand {
  514. padding-top: 0.75rem;
  515. padding-bottom: 0.75rem;
  516. font-size: 1rem;
  517. }
  518. nav.nav.nav-pills {
  519. .nav-item.nav-link {
  520. padding: 0.25rem 0.5rem;
  521. font-size: $font-size-sm;
  522. border-radius: $border-radius;
  523. &:hover {
  524. background-color: $accordion-button-active-bg;
  525. color: $accordion-button-active-color;
  526. }
  527. }
  528. }
  529. // Ensure the content container is full-height, and that the content block is also full height so
  530. // that the footer is always at the bottom.
  531. div.content-container {
  532. position: relative;
  533. min-height: 100vh;
  534. display: flex;
  535. flex-direction: column;
  536. width: calc(100% - 4.5rem);
  537. overflow-x: hidden;
  538. overflow-y: auto;
  539. @include media-breakpoint-down(lg) {
  540. width: 100%;
  541. }
  542. div.content {
  543. flex: 1;
  544. }
  545. }
  546. // Prevent scrolling of body content when nav menu is open on mobile.
  547. .sidebar.collapse.show ~ .content-container > .content {
  548. @media (max-width: map.get($grid-breakpoints, 'md')) {
  549. position: fixed;
  550. top: 0;
  551. left: 0;
  552. overflow-y: hidden;
  553. }
  554. }
  555. .sidebar {
  556. position: fixed;
  557. top: 0;
  558. bottom: 0;
  559. left: 0;
  560. z-index: 100; // Behind the navbar
  561. border-right: 1px solid $border-color;
  562. background-color: var(--nbx-sidebar-bg);
  563. max-height: 100%;
  564. width: 100%;
  565. @include media-breakpoint-up(md) {
  566. width: 100%;
  567. max-width: $sidebar-width;
  568. }
  569. @include media-breakpoint-down(md) {
  570. top: 8.125rem;
  571. background-color: var(--nbx-body-bg);
  572. }
  573. div.accordion-item {
  574. border: unset;
  575. padding: 0 $spacer / 2;
  576. // When an sidenav section is open, apply a shadow to provide a visual border.
  577. &.is-open {
  578. box-shadow: var(--nbx-sidebar-shadow);
  579. }
  580. & > a.accordion-button {
  581. &:not(.collapsed) {
  582. box-shadow: unset;
  583. }
  584. &.nav-link {
  585. border-radius: $border-radius;
  586. &:hover {
  587. color: $accordion-button-active-color;
  588. background-color: $accordion-button-active-bg;
  589. }
  590. &:focus {
  591. border-color: unset;
  592. box-shadow: unset;
  593. }
  594. }
  595. }
  596. }
  597. .accordion-body {
  598. max-height: calc(100vh - 24rem);
  599. overflow-y: auto;
  600. .nav-item {
  601. .nav-link {
  602. padding: 0.25rem 0.6rem;
  603. font-size: $font-size-sm;
  604. border-radius: $border-radius;
  605. &:hover {
  606. color: $accordion-button-active-color;
  607. background-color: $accordion-button-active-bg;
  608. }
  609. }
  610. }
  611. }
  612. // Ensure navigation accounts for the height of the header on mobile when nav is expanded.
  613. &.collapse.show div.position-sticky {
  614. @media (max-width: map.get($grid-breakpoints, 'md')) {
  615. height: calc(100vh - 16.125rem);
  616. overflow-y: auto;
  617. }
  618. }
  619. div.position-sticky {
  620. height: calc(100vh - #{$sidebar-bottom-height});
  621. }
  622. div.sidebar-bottom {
  623. padding-left: 0.5rem;
  624. padding-right: 0.5rem;
  625. position: sticky;
  626. height: $sidebar-bottom-height;
  627. background-color: var(--nbx-sidebar-bg);
  628. @include media-breakpoint-down(md) {
  629. background-color: var(--nbx-body-bg);
  630. }
  631. .nav {
  632. padding: 0 0.5rem;
  633. justify-content: space-between;
  634. margin: $spacer/2 0;
  635. .nav-link {
  636. padding: 0.5rem 0.25rem;
  637. }
  638. }
  639. }
  640. a.sidebar-logo {
  641. display: flex;
  642. flex-shrink: 1;
  643. width: 100%;
  644. height: 3rem;
  645. }
  646. }
  647. .tooltip {
  648. pointer-events: none;
  649. }
  650. .ws-nowrap {
  651. white-space: nowrap !important;
  652. }
  653. .search-obj-selector {
  654. @include media-breakpoint-down(lg) {
  655. // Limit the height and enable scrolling on mobile devices.
  656. max-height: 75vh;
  657. overflow-y: auto;
  658. }
  659. .dropdown-item,
  660. .dropdown-header {
  661. font-size: $font-size-sm;
  662. }
  663. .dropdown-header {
  664. text-transform: uppercase;
  665. }
  666. }
  667. span.color-label {
  668. width: 5rem;
  669. height: 1rem;
  670. display: block;
  671. box-shadow: $box-shadow-sm;
  672. border: 1px solid #303030;
  673. border-radius: $border-radius;
  674. padding: $badge-padding-y $badge-padding-x;
  675. }
  676. pre {
  677. border-radius: $border-radius;
  678. border: 1px solid var(--nbx-pre-border-color);
  679. background-color: var(--nbx-pre-bg);
  680. padding: $spacer;
  681. white-space: pre;
  682. }
  683. .btn {
  684. white-space: nowrap;
  685. }
  686. .card {
  687. box-shadow: $box-shadow-sm;
  688. .card-header {
  689. color: $body-color;
  690. border-bottom: none;
  691. padding: $card-cap-padding-x;
  692. }
  693. .card-header + .card-body {
  694. padding-top: 0;
  695. }
  696. .card-body.small .form-control,
  697. .card-body.small .form-select {
  698. font-size: $input-font-size-sm;
  699. }
  700. }
  701. .form-floating {
  702. position: relative;
  703. > .input-group > .form-control,
  704. > .input-group > .form-select {
  705. height: $form-floating-height;
  706. padding: $form-floating-padding-y $form-floating-padding-x;
  707. }
  708. > .input-group > label {
  709. position: absolute;
  710. top: 0;
  711. left: 0;
  712. height: 100%; // allow textareas
  713. padding: $form-floating-padding-y $form-floating-padding-x;
  714. pointer-events: none;
  715. border: $input-border-width solid transparent; // Required for aligning label's text with the input as it affects inner box model
  716. transform-origin: 0 0;
  717. @include transition($form-floating-transition);
  718. }
  719. > .input-group > .form-control {
  720. &::placeholder {
  721. color: transparent;
  722. }
  723. &:focus,
  724. &:not(:placeholder-shown) {
  725. padding-top: $form-floating-input-padding-t;
  726. padding-bottom: $form-floating-input-padding-b;
  727. }
  728. // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
  729. &:-webkit-autofill {
  730. padding-top: $form-floating-input-padding-t;
  731. padding-bottom: $form-floating-input-padding-b;
  732. }
  733. }
  734. > .input-group > .form-select,
  735. > .choices > .choices__inner,
  736. > .ss-main span.placeholder, // SlimSelect Single
  737. > .ss-main div.ss-values // SlimSelect Multiple
  738. {
  739. padding-top: $form-floating-input-padding-t;
  740. padding-bottom: $form-floating-input-padding-b;
  741. }
  742. > .input-group > .form-control:focus,
  743. > .input-group > .form-control:not(:placeholder-shown),
  744. > .input-group > .form-select,
  745. > .choices,
  746. > .ss-main {
  747. ~ label {
  748. opacity: $form-floating-label-opacity;
  749. transform: $form-floating-label-transform;
  750. z-index: 4;
  751. }
  752. }
  753. // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
  754. > .input-group > .form-control:-webkit-autofill {
  755. ~ label {
  756. opacity: $form-floating-label-opacity;
  757. transform: $form-floating-label-transform;
  758. z-index: 4;
  759. }
  760. }
  761. }
  762. textarea.form-control[rows='10'] {
  763. height: 18rem;
  764. }
  765. textarea#id_local_context_data,
  766. textarea.markdown,
  767. textarea#id_public_key,
  768. textarea.form-control[name='csv'],
  769. textarea.form-control[name='data'] {
  770. font-family: $font-family-monospace;
  771. }
  772. table tr.vertical-align {
  773. vertical-align: middle;
  774. }
  775. .card:not(:only-of-type) {
  776. margin-bottom: $spacer;
  777. }
  778. .stat-btn {
  779. min-width: $spacer * 3;
  780. }
  781. nav.breadcrumb-container {
  782. padding: $badge-padding-y $badge-padding-x;
  783. font-size: $font-size-sm;
  784. width: fit-content;
  785. ol.breadcrumb {
  786. margin-bottom: 0;
  787. li.breadcrumb-item > a {
  788. text-decoration: none;
  789. }
  790. li.breadcrumb-item > a:hover {
  791. text-decoration: underline;
  792. }
  793. }
  794. }
  795. div.paginator > form > div.input-group {
  796. width: fit-content;
  797. }
  798. div.field-group:not(:first-of-type) {
  799. margin-top: $spacer * 3;
  800. h1,
  801. h2,
  802. h3,
  803. h4,
  804. h5,
  805. h6 {
  806. margin-bottom: $spacer;
  807. }
  808. }
  809. label.required {
  810. font-weight: $font-weight-bold;
  811. &:after {
  812. font-family: 'Material Design Icons';
  813. content: '\f06C4';
  814. font-weight: normal;
  815. font-size: 8px;
  816. font-style: normal;
  817. margin: 0 0 0 2px;
  818. text-decoration: none;
  819. display: inline-block;
  820. position: absolute;
  821. }
  822. }
  823. // Applied to containing element around table bulk-action buttons (bulk-edit, bulk-disconnect
  824. // bulk-delete, etc). Each usage of .bulk-buttons needs to have groups of buttons wrapped with
  825. // .bulk-button-group so that proper spacing is applied (even if there is only one group).
  826. div.bulk-buttons {
  827. display: flex;
  828. justify-content: space-between;
  829. margin: $spacer / 2 0;
  830. // Each group of buttons needs to be contained separately for alignment purposes. This way, you
  831. // can put some buttons in a group that aligns left, and other buttons in a group that aligns
  832. // right.
  833. > div.bulk-button-group {
  834. display: flex;
  835. flex-wrap: wrap;
  836. &:first-of-type:not(:last-of-type) {
  837. // If there are multiple bulk button groups and this is the first, the first button in the
  838. // group should *not* have left spacing applied, so the button group aligns with the rest
  839. // of the page elements.
  840. > *:first-child {
  841. margin-left: 0;
  842. }
  843. }
  844. &:last-of-type:not(:first-of-type) {
  845. // If there are multiple bulk button groups and this is the last, the last button in the
  846. // group should *not* have right spacing applied, so the button group aligns with the rest
  847. // of the page elements.
  848. > *:last-child {
  849. margin-right: 0;
  850. }
  851. }
  852. // However, the rest of the buttons should have spacing applied in all directions.
  853. > * {
  854. margin: $spacer / 4;
  855. }
  856. }
  857. }
  858. i.bi-plus:before,
  859. span.bi-plus:before {
  860. font-weight: $font-weight-bold !important;
  861. }
  862. table tbody {
  863. @each $color, $value in $theme-colors {
  864. tr.#{$color} {
  865. background-color: rgba($value, 0.15);
  866. border-color: $gray-500;
  867. }
  868. }
  869. }
  870. pre.change-data {
  871. padding-left: 0;
  872. padding-right: 0;
  873. & > span {
  874. display: block;
  875. padding-left: $spacer;
  876. padding-right: $spacer;
  877. &.added {
  878. background-color: var(--nbx-change-added);
  879. }
  880. &.removed {
  881. background-color: var(--nbx-change-removed);
  882. }
  883. }
  884. }
  885. pre.change-diff {
  886. border-color: transparent;
  887. &.change-removed {
  888. background-color: var(--nbx-change-removed);
  889. }
  890. &.change-added {
  891. background-color: var(--nbx-change-added);
  892. }
  893. }
  894. div.card-overlay {
  895. position: absolute;
  896. width: 100%;
  897. height: 100%;
  898. background-color: rgba($white, 0.75);
  899. border-radius: $border-radius;
  900. display: flex;
  901. justify-content: center;
  902. align-items: center;
  903. & > div.spinner-border {
  904. width: 6rem;
  905. height: 6rem;
  906. color: $secondary;
  907. }
  908. }
  909. div.card > div.card-header > div.table-controls {
  910. max-width: 25%;
  911. width: 100%;
  912. display: flex;
  913. align-items: center;
  914. & .form-switch.form-check-inline {
  915. flex: 1 0 auto;
  916. font-size: $font-size-sm;
  917. }
  918. }
  919. // Right-align the paginator element.
  920. .paginator {
  921. display: flex;
  922. flex-direction: column;
  923. align-items: flex-end;
  924. padding: $spacer 0;
  925. }
  926. // Tabbed content
  927. .nav-tabs {
  928. .nav-link {
  929. &:hover {
  930. // Don't show a bottom-border on a hovered nav link because it overlaps with the .nav-tab border.
  931. border-bottom-color: transparent;
  932. }
  933. &.active {
  934. // Set the background-color of an active tab to the same color as the .tab-content
  935. // background-color so it visually indicates which tab is open.
  936. background-color: $tab-content-bg;
  937. border-bottom-color: $tab-content-bg;
  938. // Move the active tab down 1px to overtake the .nav-tabs element's border, but only for that
  939. // tab. This is an ugly hack, but it works.
  940. transform: translateY(1px);
  941. }
  942. }
  943. }
  944. .tab-content {
  945. display: flex;
  946. flex-direction: column;
  947. padding: $spacer;
  948. background-color: $tab-content-bg;
  949. border-bottom: 1px solid $nav-tabs-border-color;
  950. }
  951. #django-messages {
  952. position: fixed;
  953. right: $spacer;
  954. bottom: 0;
  955. margin: $spacer;
  956. }
  957. // Page-specific styles.
  958. html {
  959. // Shade the home page content background-color.
  960. &[data-netbox-path='/'] {
  961. .content-container,
  962. .search {
  963. background-color: $gray-100 !important;
  964. }
  965. &[data-netbox-color-mode='dark'] {
  966. .content-container,
  967. .search {
  968. background-color: $darkest !important;
  969. }
  970. }
  971. }
  972. // Don't show the django-messages toasts on the login screen in favor of the alert component.
  973. &[data-netbox-path*='/login'] {
  974. #django-messages {
  975. display: none;
  976. }
  977. }
  978. }