Skip to content

Commit

Permalink
style(cta): whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Jan 8, 2025
1 parent 73d7fd2 commit 5396671
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions elements/rh-cta/rh-cta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LitElement, html, isServer, noChange } from 'lit';
import { LitElement, html, isServer } from 'lit';
import { customElement } from 'lit/decorators/custom-element.js';
import { property } from 'lit/decorators/property.js';
import { state } from 'lit/decorators/state.js';
import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';

Expand All @@ -13,7 +14,6 @@ import { colorContextConsumer, type ColorTheme } from '../../lib/context/color/c
import type { IconNameFor, IconSetName } from '@rhds/icons';

import style from './rh-cta.css';
import { state } from 'lit/decorators/state.js';

function isSupportedContent(el: Element | null): el is HTMLAnchorElement | HTMLButtonElement {
return el instanceof HTMLAnchorElement || el instanceof HTMLButtonElement;
Expand Down Expand Up @@ -106,19 +106,13 @@ export class RhCta extends LitElement {
/** when `href` is set, the link's `target` attribute */
@property() target?: string;

/**
* Icon name
*/
/** Icon name */
@property({ reflect: true }) icon?: IconNameFor<IconSetName>;

/**
* Icon set
*/
/** Icon set */
@property({ attribute: 'icon-set' }) iconSet: IconSetName = 'ui';

/**
* Sets color theme based on parent context
*/
/** Sets color theme based on parent context */
@colorContextConsumer() @state() private on?: ColorTheme;

protected override async getUpdateComplete(): Promise<boolean> {
Expand All @@ -142,17 +136,12 @@ export class RhCta extends LitElement {
const rtl = this.#dir.dir === 'rtl';
const isDefault = !variant;
const svg = isDefault;
const iconOrSvg = isDefault || !!icon;
const follower =
(variant !== 'brick' && icon) ?
html`<rh-icon .icon=${icon} .set=${iconSet ?? 'ui'}></rh-icon>`
: (variant === undefined) ?
html`<rh-icon set="ui" icon="arrow-right"></rh-icon>`
: html``;
(variant !== 'brick' && icon) ? html`<rh-icon icon=${icon} set=${iconSet ?? 'ui'}></rh-icon>`
: (variant === undefined) ? html`<rh-icon icon="arrow-right" set="ui"></rh-icon>`
: '';
const iconContent =
(variant === 'brick' && icon) ?
html`<rh-icon .icon=${icon} set="${iconSet ?? 'ui'}"></rh-icon>`
: html``;
!(variant === 'brick' && icon) ? '' : html`<rh-icon .icon=${icon} set="${iconSet ?? 'ui'}"></rh-icon>`;
const linkContent =
!href ? html`<slot></slot>${follower}`
: html`<a href=${href}
Expand Down

0 comments on commit 5396671

Please sign in to comment.