action-link.pcss.css

Same filename and directory in other branches
  1. 9 core/themes/claro/css/components/action-link.pcss.css
  2. 8.9.x core/themes/claro/css/components/action-link.pcss.css
  3. 10 core/themes/claro/css/components/action-link.pcss.css

Styles for action links.

Contains Action link component and the action-links layout styles.

File

core/themes/claro/css/components/action-link.pcss.css

View source
  1. /**
  2. * @file
  3. * Styles for action links.
  4. *
  5. * Contains Action link component and the action-links layout styles.
  6. */
  7. /**
  8. * Action links layout.
  9. */
  10. .action-links {
  11. margin: var(--space-l) 0;
  12. list-style: none;
  13. }
  14. .action-links__item {
  15. display: inline-block;
  16. & + .action-links__item {
  17. & > .action-link {
  18. margin-inline-start: var(--space-s);
  19. }
  20. & > .action-link--small {
  21. margin-inline-start: var(--space-xs);
  22. }
  23. }
  24. }
  25. /**
  26. * The action link component.
  27. */
  28. .action-link {
  29. display: inline-block;
  30. padding: calc(var(--space-m) - ((var(--space-l) - var(--space-m)) / 2)) var(--space-m);
  31. cursor: pointer;
  32. text-decoration: none;
  33. color: var(--color-gray-800);
  34. border-radius: var(--button-border-radius-size);
  35. background-color: var(--color-bg);
  36. font-size: var(--font-size-base);
  37. font-weight: 700;
  38. line-height: var(--space-l);
  39. /* Bigger line-height needed to prevent the icon from increasing the height */
  40. -webkit-font-smoothing: antialiased;
  41. /* Action link states */
  42. &:hover {
  43. text-decoration: none;
  44. color: var(--color-absolutezero-hover);
  45. background-color: var(--color-bgblue-hover);
  46. }
  47. &:focus {
  48. position: relative;
  49. z-index: 1;
  50. text-decoration: none;
  51. }
  52. &:active {
  53. color: var(--color-absolutezero-active);
  54. background-color: var(--color-bgblue-active);
  55. }
  56. /**
  57. * Action link icons with states.
  58. *
  59. * We use parent-relative units here to follow the .action-link's font size.
  60. */
  61. /* Defaults for icons */
  62. &::before {
  63. position: relative;
  64. inset-block-start: 0.125rem;
  65. /* Set the proper vertical alignment */
  66. display: inline-block;
  67. width: 1em;
  68. height: 1em;
  69. margin-inline: calc(var(--space-s) - var(--space-m)) 0.5em;
  70. background-repeat: no-repeat;
  71. background-position: center;
  72. background-size: contain;
  73. }
  74. & + .action-link {
  75. margin-inline-start: var(--space-s);
  76. }
  77. /**
  78. * Action links inside form-actions.
  79. *
  80. * Add the same margin for action-link inside form-actions as button has.
  81. */
  82. .form-actions &,
  83. .field-actions
  84. }
  85. .no-touchevents {
  86. /* Small variant. */
  87. & .action-link--small {
  88. padding: calc(var(--space-s) - ((var(--space-l) - var(--space-s)) / 2)) var(--space-s);
  89. font-size: var(--font-size-s);
  90. }
  91. /* Extra small variant. */
  92. & .action-link--extrasmall {
  93. padding: 0 var(--space-xs);
  94. font-size: var(--font-size-s);
  95. }
  96. & .action-link--small + .action-link--small,
  97. & .action-link--extrasmall + .action-link--extrasmall {
  98. margin-inline-start: var(--space-xs);
  99. }
  100. }
  101. /**
  102. * Action link variants.
  103. */
  104. /* Danger. */
  105. .action-link--danger {
  106. color: var(--color-maximumred);
  107. &:hover {
  108. color: var(--color-maximumred-hover);
  109. background-color: var(--color-bgred-hover);
  110. }
  111. &:active {
  112. color: var(--color-maximumred-active);
  113. background-color: var(--color-bgred-active);
  114. }
  115. }
  116. .no-touchevents .action-link--small::before,
  117. .no-touchevents .action-link--extrasmall::before {
  118. inset-block-start: 0.0625rem;
  119. /* Set the proper vertical alignment */
  120. width: var(--space-s);
  121. height: var(--space-s);
  122. margin-inline: -0.125rem 0.4em;
  123. }
  124. .action-link--icon-plus {
  125. /* Plus */
  126. &::before {
  127. content: "";
  128. background-image: url(../../images/icons/545560/plus.svg);
  129. @media (forced-colors: active) {
  130. background: linktext !important;
  131. mask-repeat: no-repeat;
  132. mask-image: url(../../images/icons/d72222/plus.svg);
  133. }
  134. }
  135. &:hover::before {
  136. background-image: url(../../images/icons/0036b1/plus.svg);
  137. }
  138. &:active::before {
  139. background-image: url(../../images/icons/002e9a/plus.svg);
  140. }
  141. &.action-link--danger {
  142. /* Plus — danger */
  143. &::before {
  144. background-image: url(../../images/icons/d72222/plus.svg);
  145. }
  146. &:hover::before {
  147. background-image: url(../../images/icons/c11f1f/plus.svg);
  148. }
  149. &:active::before {
  150. background-image: url(../../images/icons/ab1b1b/plus.svg);
  151. }
  152. }
  153. }
  154. .action-link--icon-trash {
  155. /* Trash */
  156. &::before {
  157. content: "";
  158. background-image: url(../../images/icons/545560/trash.svg);
  159. @media (forced-colors: active) {
  160. background: linktext !important;
  161. mask-repeat: no-repeat;
  162. mask-image: url(../../images/icons/d72222/trash.svg);
  163. }
  164. }
  165. &:hover::before {
  166. background-image: url(../../images/icons/0036b1/trash.svg);
  167. }
  168. &:active::before {
  169. background-image: url(../../images/icons/002e9a/trash.svg);
  170. }
  171. &.action-link--danger {
  172. /* Trash — danger */
  173. &::before {
  174. background-image: url(../../images/icons/d72222/trash.svg);
  175. }
  176. &:hover::before {
  177. background-image: url(../../images/icons/c11f1f/trash.svg);
  178. }
  179. &:active::before {
  180. background-image: url(../../images/icons/ab1b1b/trash.svg);
  181. }
  182. }
  183. }
  184. .action-link--icon-ex {
  185. /* Ex */
  186. &::before {
  187. content: "";
  188. background-image: url(../../images/icons/545560/ex.svg);
  189. @media (forced-colors: active) {
  190. background: linktext !important;
  191. mask-repeat: no-repeat;
  192. mask-image: url(../../images/icons/d72222/ex.svg);
  193. }
  194. }
  195. &:hover::before {
  196. background-image: url(../../images/icons/0036b1/ex.svg);
  197. }
  198. &:active::before {
  199. background-image: url(../../images/icons/002e9a/ex.svg);
  200. }
  201. &.action-link--danger {
  202. /* Ex — danger */
  203. &::before {
  204. background-image: url(../../images/icons/d72222/ex.svg);
  205. }
  206. &:hover::before {
  207. background-image: url(../../images/icons/c11f1f/ex.svg);
  208. }
  209. &:active::before {
  210. background-image: url(../../images/icons/ab1b1b/ex.svg);
  211. }
  212. }
  213. }
  214. .action-link--icon-checkmark {
  215. /* Checkmark */
  216. &::before {
  217. content: "";
  218. background-image: url(../../images/icons/545560/checkmark.svg);
  219. @media (forced-colors: active) {
  220. background: linktext !important;
  221. mask-repeat: no-repeat;
  222. mask-image: url(../../images/icons/d72222/checkmark.svg);
  223. }
  224. }
  225. &:hover::before {
  226. background-image: url(../../images/icons/0036b1/checkmark.svg);
  227. }
  228. &:active::before {
  229. background-image: url(../../images/icons/002e9a/checkmark.svg);
  230. }
  231. &.action-link--danger {
  232. /* Checkmark — danger */
  233. &::before {
  234. background-image: url(../../images/icons/d72222/checkmark.svg);
  235. }
  236. &:hover::before {
  237. background-image: url(../../images/icons/c11f1f/checkmark.svg);
  238. }
  239. &:active::before {
  240. background-image: url(../../images/icons/ab1b1b/checkmark.svg);
  241. }
  242. }
  243. }
  244. .action-link--icon-cog {
  245. /* Cog */
  246. &::before {
  247. content: "";
  248. background-image: url(../../images/icons/545560/cog.svg);
  249. @media (forced-colors: active) {
  250. background: linktext !important;
  251. mask-repeat: no-repeat;
  252. mask-image: url(../../images/icons/d72222/cog.svg);
  253. }
  254. }
  255. &:hover::before {
  256. background-image: url(../../images/icons/0036b1/cog.svg);
  257. }
  258. &:active::before {
  259. background-image: url(../../images/icons/002e9a/cog.svg);
  260. }
  261. &.action-link--danger {
  262. /* Cog — danger */
  263. &::before {
  264. background-image: url(../../images/icons/d72222/cog.svg);
  265. }
  266. &:hover::before {
  267. background-image: url(../../images/icons/c11f1f/cog.svg);
  268. }
  269. &:active::before {
  270. background-image: url(../../images/icons/ab1b1b/cog.svg);
  271. }
  272. }
  273. }
  274. .action-link--icon-show {
  275. /* Show */
  276. &::before {
  277. content: "";
  278. background-image: url(../../images/icons/545560/show.svg);
  279. @media (forced-colors: active) {
  280. background: linktext !important;
  281. mask-repeat: no-repeat;
  282. mask-image: url(../../images/icons/d72222/show.svg);
  283. }
  284. }
  285. &:hover::before {
  286. background-image: url(../../images/icons/0036b1/show.svg);
  287. }
  288. &:active::before {
  289. background-image: url(../../images/icons/002e9a/show.svg);
  290. }
  291. &.action-link--danger {
  292. /* Show - danger */
  293. &::before {
  294. background-image: url(../../images/icons/d72222/show.svg);
  295. }
  296. &:hover::before {
  297. background-image: url(../../images/icons/c11f1f/show.svg);
  298. }
  299. &:active::before {
  300. background-image: url(../../images/icons/ab1b1b/show.svg);
  301. }
  302. }
  303. }
  304. .action-link--icon-hide {
  305. /* Hide */
  306. &::before {
  307. content: "";
  308. background-image: url(../../images/icons/545560/hide.svg);
  309. @media (forced-colors: active) {
  310. background: linktext !important;
  311. mask-repeat: no-repeat;
  312. mask-image: url(../../images/icons/d72222/hide.svg);
  313. }
  314. }
  315. &:hover::before {
  316. background-image: url(../../images/icons/0036b1/hide.svg);
  317. }
  318. &:active::before {
  319. background-image: url(../../images/icons/002e9a/hide.svg);
  320. }
  321. &.action-link--danger {
  322. /* Hide - danger */
  323. &::before {
  324. background-image: url(../../images/icons/d72222/hide.svg);
  325. }
  326. &:hover::before {
  327. background-image: url(../../images/icons/c11f1f/hide.svg);
  328. }
  329. &:active::before {
  330. background-image: url(../../images/icons/ab1b1b/hide.svg);
  331. }
  332. }
  333. }
  334. .action-link--icon-key {
  335. /* Key */
  336. &::before {
  337. content: "";
  338. background-image: url("../../images/icons/545560/key.svg");
  339. @media (forced-colors: active) {
  340. background: linktext !important;
  341. mask-repeat: no-repeat;
  342. mask-image: url(../../images/icons/d72222/key.svg);
  343. }
  344. }
  345. &:hover::before {
  346. background-image: url("../../images/icons/0036b1/key.svg");
  347. }
  348. &:active::before {
  349. background-image: url("../../images/icons/002e9a/key.svg");
  350. }
  351. &.action-link--danger {
  352. /* Key — danger */
  353. &::before {
  354. background-image: url("../../images/icons/d72222/key.svg");
  355. }
  356. &:hover::before {
  357. background-image: url("../../images/icons/c11f1f/key.svg");
  358. }
  359. &:active::before {
  360. background-image: url("../../images/icons/ab1b1b/key.svg");
  361. }
  362. }
  363. }
  364. .action-link--icon-questionmark {
  365. /* Question Mark */
  366. &::before {
  367. content: "";
  368. background-image: url("../../images/icons/545560/questionmark.svg");
  369. @media (forced-colors: active) {
  370. background: linktext !important;
  371. mask-repeat: no-repeat;
  372. mask-image: url(../../images/icons/d72222/questionmark.svg);
  373. }
  374. }
  375. &:hover::before {
  376. background-image: url("../../images/icons/0036b1/questionmark.svg");
  377. }
  378. &:active::before {
  379. background-image: url("../../images/icons/002e9a/questionmark.svg");
  380. }
  381. &.action-link--danger {
  382. /* Question Mark - danger */
  383. &::before {
  384. background-image: url("../../images/icons/d72222/questionmark.svg");
  385. }
  386. &:hover::before {
  387. background-image: url("../../images/icons/c11f1f/questionmark.svg");
  388. }
  389. &:active::before {
  390. background-image: url("../../images/icons/ab1b1b/questionmark.svg");
  391. }
  392. }
  393. }
  394. .action-link--icon-chevron-left {
  395. &::before {
  396. display: block;
  397. content: "";
  398. background-image: url("../../images/icons/545560/pager-prev.svg");
  399. }
  400. }
  401. @media (min-width: 30em) {
  402. .action-link--icon-chevron-left {
  403. &::before {
  404. display: inline-block;
  405. }
  406. }
  407. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.