Skip to content

Commit

Permalink
feat: Final fixes (#117)
Browse files Browse the repository at this point in the history
* Fix button styles

* Improve templates

* Allow button to go full width and consistently use data attributes

* Adapt design tokens
  • Loading branch information
jkimmeyer authored Nov 26, 2023
1 parent 41ab783 commit e7e2a6e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions design-tokens-b.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/* Color Palette */
--pano-black-1: hsla(0, 0%, 100%, 1);
--pano-black-2: hsla(0, 0%, 80%, 1);
--pano-black-2: hsla(0, 0%, 60%, 1);
--pano-black-3: hsla(0, 0%, 40%, 1);
--pano-black-4: hsla(0, 0%, 20%, 1);
--pano-black-5: hsla(0, 0%, 0%, 1);
Expand All @@ -42,7 +42,7 @@
/* Color */
--color-primary: var(--pano-black-5);
--color-on-primary: var(--pano-white);
--color-primary-container: var(--pano-black-3);
--color-primary-container: var(--pano-black-2);
--color-primary-on-container: var(--pano-black);

--color-secondary: var(--pano-royal-blue-5);
Expand Down
14 changes: 11 additions & 3 deletions plop-templates/button/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@
},
"iconOnly": {
"type": "boolean",
"default": false
"default": false,
"attribute": "icon-only"
},
"iconBefore": {
"type": "string",
"default": ""
"default": "",
"attribute": "icon-before"
},
"fullWidth": {
"type": "boolean",
"default": false,
"attribute": "full-width"
},
"iconAfter": {
"type": "string",
"default": ""
"default": "",
"attribute": "icon-after"
},
"href": {
"type": "string",
Expand Down
7 changes: 6 additions & 1 deletion plop-templates/button/component.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export const buttonStyles = css`
color: var(--button-color);
background-color: var(--button-background-color);
cursor: pointer;
&[data-full-width] {
width: 100%;
display: flex;
}
}
/* Link Styles */
Expand Down Expand Up @@ -51,7 +56,7 @@ export const buttonStyles = css`
filter: brightness(var(--interaction-state-active));
}
.button[icon-only] {
.button[data-icon-only] {
aspect-ratio: 1;
}
Expand Down
5 changes: 3 additions & 2 deletions plop-templates/button/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class {{properCase meta.prefix}}Button extends LitElement {
iconAfter,
label,
href,
fullWidth,
disabled
} = this;

Expand All @@ -73,13 +74,13 @@ export class {{properCase meta.prefix}}Button extends LitElement {

if(href) {
return html`
<a class="button" href="${href}" ?icon-only="${iconOnly}" {{> dataAttributes}}>
<a class="button" href="${href}" ?data-icon-only="${iconOnly}" ?data-full-width="${fullWidth}" {{> dataAttributes}}>
${innerHtml}
</a>
`;
} else {
return html`
<button class="button" ?disabled="${disabled}" ?icon-only="${iconOnly}" {{> dataAttributes}}>
<button class="button" ?disabled="${disabled}" ?data-icon-only="${iconOnly}" ?data-full-width="${fullWidth}" {{> dataAttributes}}>
${innerHtml}
</button>
`;
Expand Down
9 changes: 8 additions & 1 deletion plop-templates/input/component.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const inputStyles = css`
.input--field {
width: 100%;
border: 1px solid var(--color-primary);
border: 1px solid var(--color-black);
border-radius: var(--space-4);
padding-block: var(--input-padding-block);
padding-inline: calc(var(--space-8) * 0.5);
Expand All @@ -26,6 +26,13 @@ export const inputStyles = css`
.input[data-icon-after] & {
padding-right: var(--icon-padding);
}
&:focus,
&:hover,
&:active {
outline: none;
border-color: var(--color-primary);
}
}
{{#each variants.sizes}}
Expand Down
1 change: 1 addition & 0 deletions plop-templates/input/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class {{properCase meta.prefix }}Input extends LitElement {
margin: 0;
padding: 0;
font: inherit;
outline: none;
}
.sr-only {
Expand Down

0 comments on commit e7e2a6e

Please sign in to comment.