atoms-element v5.0.0

#js

git clone https://git.pyrossh.dev/atoms-element

A simple web component library for defining your custom elements. It works on both client and server.


examples/pages/index.js
25308a9 1
import { createPage, css, staticHtml, unsafeHTML } from '../../index.js';
24398b1 2
import '../elements/app-counter.js';
24398b1 3
import '../elements/app-total.js';
24398b1 4
24398b1 5
const head = ({ config }) => {
25308a9 6
  const styleTag = `<style>${css`
25308a9 7
    .page {
25308a9 8
      display: flex;
25308a9 9
      flex: 1;
25308a9 10
      flex-direction: column;
25308a9 11
      align-items: center;
25308a9 12
      justify-content: center;
25308a9 13
    }
25308a9 14
  `}</style>`;
25308a9 15
  return staticHtml`
e264357 16
    <title>${config.title}</title>
0000000 17
    <link rel="stylesheet" href="/node_modules/normalize.css/normalize.css" />
25308a9 18
    ${unsafeHTML(styleTag)}
e264357 19
  `;
24398b1 20
};
24398b1 21
24398b1 22
const body = () => {
25308a9 23
  return staticHtml`
e264357 24
    <div class="page">
ba74771 25
      <app-counter name="1" count="5"></app-counter>
ba74771 26
      <app-counter name="2" count="7"></app-counter>
e264357 27
      <app-total></app-total>
24398b1 28
    </div>
24398b1 29
  `;
24398b1 30
};
24398b1 31
24398b1 32
export default createPage({
24398b1 33
  head,
24398b1 34
  body,
24398b1 35
});