Skip to content

Commit

Permalink
Updated templates
Browse files Browse the repository at this point in the history
  • Loading branch information
eKrausedivae committed Apr 19, 2024
1 parent 1b3cad8 commit 6a92f61
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion componentGenerator/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ async function getConfig(configPath) {
*/
async function enquiry(prompts, cliOptions = {}) {
const answers = await inquirer.prompt(prompts, cliOptions);

return answers;
}

Expand Down
17 changes: 13 additions & 4 deletions componentGenerator/templates/tsTemplateBlock.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@ export default function ({ kebabCase }) {
return `import { html, render } from 'lit';
import './${kebabCase}.scss';
const template = () => {
interface TemplateArgs {
heading: string;
text: string;
}
const template = (args: TemplateArgs) => {
const { heading, text } = args;
return html\`
<h1>This is a heading.</h1>
<p>This is text.</p>
<h1>\${heading}</h1>
<p>\${text}</p>
\`;
};
export default function decorate(block: HTMLElement) {
const heading: string = "This is a heading.";
const text: string = "This is text.";
block.style.removeProperty('display');
render(template(), block);
render(template({ heading, text }), block);
}
`;
}
4 changes: 4 additions & 0 deletions componentGenerator/templates/tsTemplateComponent.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import './${kebabCase}.scss';
@customElement('${kebabCase}')
export class ${pascalCase} extends LitElement {
protected createRenderRoot(): HTMLElement | DocumentFragment {
return this;
}
render() {
return html\`
<h1>This is a heading.</h1>
Expand Down

0 comments on commit 6a92f61

Please sign in to comment.