Skip to content

Commit

Permalink
Add Test component
Browse files Browse the repository at this point in the history
  • Loading branch information
viktoria-mahmud authored and smoqadam committed May 30, 2023
1 parent 2a29690 commit 618b215
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions assets/js/components/TestComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

module.exports = class TestComponent {

constructor($elm, _window = window, doc = document) {
if (!$elm) {
return;
}

this.$elm = $elm;
this.window = _window;
this.doc = doc;

this.$elm.addEventListener('click', this.changeText.bind(this));
}

changeText() {
this.$elm.innerHTML = "Clicked!"
}
};
1 change: 1 addition & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Components.SelectNav = require('./components/SelectNav');
Components.SideBySideView = require('./components/SideBySideView');
Components.SiteHeader = require('./components/SiteHeader');
Components.SpeechBubble = require('./components/SpeechBubble');
Components.TestComponent = require('./components/TestComponent');
Components.ToggleableCaption = require('./components/ToggleableCaption');
Components.Twitter = require('./components/Twitter');
Components.ViewerModal = require('./components/ViewerModal');
Expand Down
5 changes: 5 additions & 0 deletions assets/sass/patterns/atoms/test-component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../../definitions";

.test-component--wrapper {
color: $color-attention;
}
3 changes: 3 additions & 0 deletions source/_patterns/00-atoms/components/test-component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "Click me!"
}
3 changes: 3 additions & 0 deletions source/_patterns/00-atoms/components/test-component.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="test-component--wrapper" data-behaviour="TestComponent">
{{name}}
</div>
8 changes: 8 additions & 0 deletions source/_patterns/00-atoms/components/test-component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$schema: http://json-schema.org/draft-04/schema#
type: object
properties:
name:
type: string
minLength: 1
required:
- name

0 comments on commit 618b215

Please sign in to comment.