notifications.scss 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. @mixin light-notification {
  2. --notification-bg-info: var(--bg-info-03);
  3. --notification-bg-success: var(--bg-accent-03);
  4. --notification-bg-warning: var(--bg-warning-03);
  5. --notification-bg-error: var(--bg-danger-03);
  6. --notification-bg-offer: var(--bg-light-primary);
  7. --notification-border-info: var(--blue-20);
  8. --notification-border-success: var(--green-20);
  9. --notification-border-warning: var(--yellow-20);
  10. --notification-border-error: var(--red-20);
  11. --notification-border-offer: var(--neutral-20);
  12. --notification-icon-info: var(--blue-50);
  13. --notification-icon-success: var(--green-50);
  14. --notification-icon-warning: var(--yellow-40);
  15. --notification-icon-error: var(--red-50);
  16. --notification-icon-offer: var(--neutral-50);
  17. --notification-content-primary: var(--content-primary);
  18. --notification-content-secondary: var(--content-secondary);
  19. --notification-bg-primary: var(--neutral-90);
  20. --notification-reconfirmation-bg: var(--bg-light-secondary);
  21. --notification-disclaimer-color: var(--neutral-60);
  22. --notification-close-btn-bg: rgb(27 34 44 / 8%);
  23. }
  24. @mixin dark-notification {
  25. --notification-bg-info: var(--blue-70);
  26. --notification-bg-success: var(--green-70);
  27. --notification-bg-warning: var(--yellow-70);
  28. --notification-bg-error: var(--red-70);
  29. --notification-bg-offer: var(--neutral-70);
  30. --notification-border-info: var(--blue-60);
  31. --notification-border-success: var(--green-60);
  32. --notification-border-warning: var(--yellow-60);
  33. --notification-border-error: var(--red-60);
  34. --notification-border-offer: var(--neutral-60);
  35. --notification-icon-info: var(--blue-30);
  36. --notification-icon-success: var(--green-30);
  37. --notification-icon-warning: var(--yellow-20);
  38. --notification-icon-error: var(--red-20);
  39. --notification-icon-offer: var(--neutral-20);
  40. --notification-content-primary: var(--content-primary-dark);
  41. --notification-content-secondary: var(--content-secondary-dark);
  42. --notification-bg-primary: var(--neutral-10);
  43. --notification-reconfirmation-bg: var(--bg-dark-secondary);
  44. --notification-disclaimer-color: var(--neutral-40);
  45. --notification-close-btn-bg: rgb(255 255 255 / 8%);
  46. }
  47. :root {
  48. --notification-ai-paywall-background: var(--bg-info-03);
  49. --notification-ai-paywall-color: var(--content-primary);
  50. --notification-ai-paywall-border-color: var(--blue-60);
  51. @include light-notification;
  52. // Until we roll out dark mode notifications, make sure we show buttons in
  53. // light mode even when the rest of the page is in dark mode
  54. .ide-redesign-main .notification .btn {
  55. @include light-buttons;
  56. }
  57. @include theme('default') {
  58. --notification-ai-paywall-background: var(--bg-dark-secondary);
  59. --notification-ai-paywall-color: var(--content-primary-dark);
  60. --notification-ai-paywall-border-color: var(--blue-30);
  61. .project-ds-nav-page {
  62. .notification {
  63. @include dark-notification;
  64. @include dark-bg;
  65. .btn {
  66. @include dark-buttons;
  67. }
  68. }
  69. }
  70. }
  71. }
  72. .notification-body {
  73. // will be deprecated once notifications moved to use .notification (see below)
  74. flex-grow: 1;
  75. width: 90%;
  76. @include media-breakpoint-up(md) {
  77. width: auto;
  78. }
  79. }
  80. .notification-action {
  81. $line-height-computed: $font-size-base * $line-height-base; // 24px
  82. // will be deprecated once notifications moved to use .notification (see below)
  83. margin-top: calc($line-height-computed / 2); // match paragraph padding
  84. order: 1;
  85. @include media-breakpoint-up(md) {
  86. margin-top: 0;
  87. order: 0;
  88. padding-left: $spacing-05;
  89. }
  90. }
  91. .notification-close {
  92. // will be deprecated once notifications moved to use .notification (see below)
  93. padding-left: $spacing-05;
  94. text-align: right;
  95. width: 10%;
  96. button {
  97. aspect-ratio: 1;
  98. border-radius: 50%;
  99. display: flex;
  100. float: right;
  101. padding: 5.5px;
  102. cursor: pointer;
  103. background: transparent;
  104. border: 0;
  105. &:hover,
  106. &:focus {
  107. background-color: var(--notification-close-btn-bg);
  108. color: var(--notification-content-secondary);
  109. }
  110. }
  111. @include media-breakpoint-up(md) {
  112. width: auto;
  113. }
  114. }
  115. .notification {
  116. border-radius: $border-radius-base;
  117. color: var(--notification-content-primary);
  118. display: flex;
  119. padding: 0 $spacing-06; // vertical padding added by elements within notification
  120. width: 100%;
  121. a:not(.btn) {
  122. text-decoration: underline;
  123. }
  124. p {
  125. margin-bottom: $spacing-02;
  126. }
  127. .notification-icon {
  128. flex-grow: 0;
  129. padding: 18px $spacing-06 0 0;
  130. }
  131. .notification-icon.notification-icon-center {
  132. padding-top: 0;
  133. display: flex;
  134. align-items: center;
  135. }
  136. .notification-content-and-cta {
  137. // shared container to align cta with text on smaller screens
  138. display: flex;
  139. flex-grow: 1;
  140. flex-wrap: wrap;
  141. p:last-child {
  142. margin-bottom: 0;
  143. }
  144. }
  145. .notification-content {
  146. flex-grow: 1;
  147. padding: $spacing-06 0;
  148. text-align: left;
  149. width: 100%;
  150. }
  151. &.text-center .notification-content {
  152. text-align: center;
  153. }
  154. .notification-cta {
  155. padding-bottom: $spacing-06;
  156. a {
  157. font-weight: 700;
  158. }
  159. a,
  160. button {
  161. white-space: nowrap;
  162. }
  163. }
  164. .notification-disclaimer {
  165. color: var(--notification-disclaimer-color);
  166. font-size: $font-size-sm;
  167. padding-bottom: $spacing-06;
  168. }
  169. .notification-close-btn {
  170. height: $spacing-12;
  171. align-items: center;
  172. display: flex;
  173. padding: 0 0 0 $spacing-06;
  174. button {
  175. aspect-ratio: 1;
  176. border-radius: 50%;
  177. display: flex;
  178. float: right;
  179. padding: 5.5px;
  180. cursor: pointer;
  181. background: transparent;
  182. border: 0;
  183. color: var(--notification-content-primary);
  184. &:hover,
  185. &:focus {
  186. background-color: var(--notification-close-btn-bg);
  187. color: var(--notification-content-secondary);
  188. }
  189. }
  190. }
  191. &.notification-type-info {
  192. background-color: var(--notification-bg-info);
  193. border: 1px solid var(--notification-border-info);
  194. .notification-icon {
  195. color: var(--notification-icon-info);
  196. }
  197. }
  198. &.notification-type-success {
  199. background-color: var(--notification-bg-success);
  200. border: 1px solid var(--notification-border-success);
  201. .notification-icon {
  202. color: var(--notification-icon-success);
  203. }
  204. }
  205. &.notification-type-warning {
  206. background-color: var(--notification-bg-warning);
  207. border: 1px solid var(--notification-border-warning);
  208. .notification-icon {
  209. color: var(--notification-icon-warning);
  210. }
  211. }
  212. &.notification-type-error {
  213. background-color: var(--notification-bg-error);
  214. border: 1px solid var(--notification-border-error);
  215. .notification-icon {
  216. color: var(--notification-icon-error);
  217. }
  218. }
  219. &.notification-type-offer {
  220. background-color: var(--notification-bg-offer);
  221. border: 1px solid var(--notification-border-offer);
  222. .notification-icon {
  223. color: var(--notification-icon-offer);
  224. }
  225. }
  226. @include media-breakpoint-up(md) {
  227. &:not(.notification-cta-below-content) {
  228. .notification-content-and-cta {
  229. flex-wrap: nowrap;
  230. }
  231. .notification-content {
  232. width: auto;
  233. }
  234. .notification-cta {
  235. height: $spacing-12;
  236. padding-left: $spacing-06;
  237. padding-bottom: 0;
  238. align-items: center;
  239. display: flex;
  240. }
  241. }
  242. }
  243. }
  244. .notification-with-scroll-margin {
  245. scroll-margin: $spacing-06;
  246. }
  247. .notification-list {
  248. .notification {
  249. margin-bottom: $spacing-07;
  250. }
  251. }
  252. // Reconfirmation notification
  253. .reconfirm-notification {
  254. display: flex;
  255. width: 100%;
  256. .btn-reconfirm {
  257. float: right;
  258. margin-left: $spacing-05;
  259. text-transform: capitalize;
  260. }
  261. }
  262. .group-invitation-cancel-subscription-notification-buttons {
  263. display: flex;
  264. align-items: center;
  265. }
  266. // Settings page
  267. .affiliations-table {
  268. .reconfirm-notification {
  269. margin: 0 auto $spacing-05 !important;
  270. padding: $spacing-07;
  271. }
  272. .reconfirm-row {
  273. td {
  274. border: 0;
  275. .alert {
  276. border: 0;
  277. padding: 0;
  278. }
  279. :not(.alert) {
  280. .reconfirm-notification {
  281. background-color: var(--notification-reconfirmation-bg);
  282. border-radius: $border-radius-base;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. // Only apply bottom margin to form messages when it is non-empty
  289. .form-messages-bottom-margin > :last-child {
  290. margin-bottom: var(--spacing-06);
  291. }
  292. .ai-paywall-notification {
  293. // Override notification styles. !important is needed so that it binds
  294. // stronger than the notification variant styles.
  295. border: 2px solid var(--notification-ai-paywall-border-color) !important;
  296. background-color: var(--notification-ai-paywall-background) !important;
  297. color: var(--notification-ai-paywall-color) !important;
  298. }