1- # WIP 🐣: PFElements CTA Element
1+ # PFElements Call-to-action Element
22
33` pfe-cta ` is a call-to-action (CTA) element, that stands out from regular hypertext links, and is used for linking users to webpages.
44
@@ -10,11 +10,19 @@ _Note: `pfe-cta` is not a button, though it may look like one visually._
1010 <a href =" https://github.com/" >GitHub</a >
1111</pfe-cta >
1212
13- <pfe-cta priority =" primary" >
13+ <pfe-cta pfe- priority =" primary" >
1414 <a href =" https://pfelements.github.io/" >Learn more about PFElements</a >
1515</pfe-cta >
1616
17- <pfe-cta priority =" secondary" >
17+ <pfe-cta pfe-priority =" secondary" >
18+ <a href =" https://redhat.com/" >Red Hat</a >
19+ </pfe-cta >
20+
21+ <pfe-cta pfe-priority =" primary" pfe-color =" lightest" >
22+ <a href =" https://pfelements.github.io/" >Learn more about PFElements</a >
23+ </pfe-cta >
24+
25+ <pfe-cta pfe-priority =" secondary" pfe-color =" complement" >
1826 <a href =" https://redhat.com/" >Red Hat</a >
1927</pfe-cta >
2028```
@@ -25,23 +33,33 @@ _Note: `pfe-cta` is not a button, though it may look like one visually._
2533
2634We expect an anchor tag, ` <a> ` with an ` href ` , to be the first child inside ` pfe-cta ` element.
2735
28- ## Styling
29-
30- | Theme Var Hook | Description | Default |
31- | -------------- | ----------- | ------- |
32- | ` --pfe-theme--color--ui-link ` | Link color for default CTA | $pfe-color--ui-link |
33- | ` --pfe-theme--color--ui-link--hover ` | Hover color for default CTA | $pfe-color--ui-link--hover |
34- | ` --pfe-theme--color--ui-link--focus ` | Focus color for default CTA | $pfe-color--ui-link--focus |
35- | ` --pfe-theme--color--ui-accent ` | Color for Primary CTA | $pfe-color--ui-accent |
36- | ` --pfe-theme--color--ui-accent--hover ` | Hover color for Primary CTA | $pfe-color--ui-accent--hover |
37- | ` --pfe-theme--color--ui-accent--text ` | Text color for Primary CTA | $pfe-color--ui-accent--text |
38- | ` --pfe-theme--color--ui-accent--text--hover ` | Hover text color for Primary CTA | $pfe-color--ui-accent--text--hover |
39- | ` --pfe-theme--color--ui-base ` | Border & text color for Secondary CTA | $pfe-color--ui-base |
40- | ` --pfe-theme--color--ui-base--hover ` | Hover color for Secondary CTA | $pfe-color--ui-base--hover |
41- | ` --pfe-theme--color--ui-base--text ` | Background color for Secondary CTA | $pfe-color--ui-base--text |
42- | ` --pfe-theme--color--ui-base--text--hover ` | Hover text color for Secondary CTA | $pfe-color--ui-base--text--hover |
43- | ` --pfe-theme--color--text--on-dark ` | Link color for default CTA with ` on="dark" ` | $pfe-color--text--on-dark |
44- | ` --pfe-theme--color--ui-link--on-dark--hover ` | Hover color for default CTA with ` on="dark" ` | $pfe-color--ui-link--on-dark--hover |
36+ ## Styling approach
37+
38+ ```
39+ // 1. set up local vars equal to theme vars & fallbacks
40+ :host {
41+ --pfe-cta--Color: var(--pfe-theme--ui-link, #06c);
42+ }
43+
44+ // 2. Use color property once, map to local var value
45+ :host(:not([priority]) {
46+ ::slotted(a) {
47+ //color: blue; CSS compiler will print this for IE11
48+ color: var(--pfe-cta--Color, blue) !important;
49+ }
50+ }
51+
52+ // 3. Use broadcasted variables as needed, with theme fallback after other declarations
53+ :host {
54+ --pfe-cta--Color: var(--pfe-broadcasted--ui-link, var(--pfe-theme--ui-link, #06c));
55+ }
56+
57+ // 4. Override broadcasted last
58+ [color="accent"] {
59+ --pfe-cta--Color: var(--pfe-theme--ui-accent);
60+ }
61+ ```
62+
4563
4664### Testing Theme Var Hooks
4765
@@ -50,10 +68,9 @@ If you'd like to checkout how theming is possible using our CSS Var hooks, try a
5068``` html
5169<style >
5270:root {
53- --pfe-theme--color--ui-accent : green ;
54- --pfe-theme--color--ui-accent--hover : darkgreen ;
55- --pfe-theme--color--ui-accent--text : white ;
56- --pfe-theme--color--ui-accent--text--hover : white ;
71+ --pfe-theme--color--ui-accent : green ;
72+ --pfe-theme--color--ui-accent--hover : darkgreen ;
73+ --pfe-theme--color--ui-accent--text : white ;
5774}
5875 </style >
5976```
0 commit comments