Skip to content

Commit

Permalink
Merge pull request #38 from kacper-cyra/UIredButton
Browse files Browse the repository at this point in the history
RedButton added
  • Loading branch information
kacper-cyra authored Dec 19, 2021
2 parents 6783026 + 282f422 commit e740581
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/RedButton/RedButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as classes from './style.module.scss';

export const RED_BUTTON_COMPONENT_NAME = 'red-button-component';

class Button extends HTMLElement {
constructor() {
super();
this._contents = new DocumentFragment();

this.redButton = Button.redButtonBuilder();

this._contents.appendChild(this.redButton);
}

connectedCallback() {
this.appendChild(this._contents);
}

static redButtonBuilder(caption) {
const redButton = document.createElement('button');
redButton.className = classes.redButton;
redButton.innerText = caption;

return redButton;
}
}

customElements.define(RED_BUTTON_COMPONENT_NAME, Button);
14 changes: 14 additions & 0 deletions src/components/RedButton/style.modules.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@use '../../themes/theme.scss' as *;

.red-button {
background-color: red;
border: none;
border-radius: $border-radius;
box-shadow: $red-box-shadow;
color: white;
font-family: $font-family;
font-weight: 400;
font-size: 2em;
text-transform: uppercase;
width: 100%;
}

0 comments on commit e740581

Please sign in to comment.