Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions elements/rh-cta/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,62 @@
# WIP 🐣: RHElements Cta Element
# WIP 🐣: RHElements CTA Element

`rh-cta` is a call-to-action (CTA) element, that stands out from regular hypertext links, and is used for linking users to webpages.

_Note: `rh-cta` is not a button, though it may look like one visually._

## Usage
```html
<rh-cta>
<a href="https://github.com/">GitHub</a>
</rh-cta>

<rh-cta priority="primary">
<a href="https://rhelements.github.io/">Learn more about RHElements</a>
</rh-cta>

<rh-cta priority="secondary">
<a href="https://redhat.com/">Red Hat</a>
</rh-cta>
```

## Slots

### Default slot

We expect an anchor tag, `<a>`, to be the first child inside rh-cta element.
We expect an anchor tag, `<a>` with an `href`, to be the first child inside `rh-cta` element.

## Styling

| Theme Var Hook | Description | Default |
| -------------- | ----------- | ------- |
| --rh-theme--color--ui-link | Link color for default CTA | $rh-color--ui-link |
| --rh-theme--color--ui-link--hover | Hover color for default CTA | $rh-color--ui-link--hover |
| --rh-theme--color--ui-link--focus | Focus color for default CTA | $rh-color--ui-link--focus |
| --rh-theme--color--ui-accent | Color for Primary CTA | $rh-color--ui-accent |
| --rh-theme--color--ui-accent--hover | Hover color for Primary CTA | $rh-color--ui-accent--hover |
| --rh-theme--color--ui-accent--text | Text color for Primary CTA | $rh-color--ui-accent--text |
| --rh-theme--color--ui-accent--text--hover | Hover text color for Primary CTA | $rh-color--ui-accent--text--hover |
| --rh-theme--color--ui-base | Border & text color for Secondary CTA | $rh-color--ui-base |
| --rh-theme--color--ui-base--hover | Hover color for Secondary CTA | $rh-color--ui-base--hover |
| --rh-theme--color--ui-base--text | Background color for Secondary CTA | $rh-color--ui-base--text |
| --rh-theme--color--ui-base--text--hover | Hover text color for Secondary CTA | $rh-color--ui-base--text--hover |
| --rh-theme--color--text--on-dark | Link color for default CTA with `on="dark"` | $rh-color--text--on-dark |
| --rh-theme--color--ui-link--on-dark--hover | Hover color for default CTA with `on="dark"` | $rh-color--ui-link--on-dark--hover |

### Testing Theme Var Hooks

If you'd like to checkout how theming is possible using our CSS Var hooks, try adding the following to the `<head>` of `./demo/index.html` before running `npm run test`. Feel free to customize the colors too!

```html
<style>
:root {
--rh-theme--color--ui-accent: green;
--rh-theme--color--ui-accent--hover: darkgreen;
--rh-theme--color--ui-accent--text: white;
--rh-theme--color--ui-accent--text--hover: white;
}
</style>
```

## Test

Expand Down
2 changes: 1 addition & 1 deletion elements/rh-cta/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>RHElements: rh-cta Demo</title>

<!-- <link rel="stylesheet" href="../../../themes/cp-theme/cp-theme.css" /> -->
<link rel="stylesheet" href="http://overpass-30e2.kxcdn.com/overpass.css" />
<!-- <link rel="stylesheet" href="../../../themes/cp-theme/cp-theme.css" /> -->

<!-- uncomment the es5-adapter if you're using the umd version -->
<script src="/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions elements/rh-cta/rh-cta.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion elements/rh-cta/rh-cta.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion elements/rh-cta/rh-cta.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading