Skip to content

Commit

Permalink
chore: move copy templates to root of the package
Browse files Browse the repository at this point in the history
  • Loading branch information
tzachbon committed May 8, 2022
1 parent cf9b374 commit 6d3d003
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions component/javascript/class/index.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { {{name}} } from './{{name}}';
1 change: 1 addition & 0 deletions component/javascript/class/style.{{style}}.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.{{name}} {}
19 changes: 19 additions & 0 deletions component/javascript/class/{{name}}.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
{{#propTypes}}
import PropTypes from 'prop-types';
{{/propTypes}}
{{#style}}
import {{#cssModules}}classes from {{/cssModules}}'./style.{{style}}';
{{/style}}

export class {{name}} extends React.Component {
render() {
return <div className={{#cssModules}}{classes.{{name}}}{{/cssModules}}{{^cssModules}}"{{name}}"{{/cssModules}}>{{name}} works!</div>;
}
}
{{#propTypes}}

{{name}}.propTypes = {
className: PropTypes.string,
};
{{/propTypes}}
10 changes: 10 additions & 0 deletions component/javascript/class/{{name}}.test.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import { {{name}} } from './{{name}}';

describe('{{name}}', () => {
it('should match snapshot', () => {
const { getByText } = render(<{{name}} />);
const linkElement = getByText(/{{name}} works!/i);
expect(linkElement).toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions component/javascript/function/index.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { {{name}} } from './{{name}}';
1 change: 1 addition & 0 deletions component/javascript/function/style.{{style}}.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.{{name}} {}
16 changes: 16 additions & 0 deletions component/javascript/function/{{name}}.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{#propTypes}}
import PropTypes from 'prop-types';
{{/propTypes}}
{{#style}}
import {{#cssModules}}classes from {{/cssModules}}'./style.{{style}}';
{{/style}}

export const {{name}} = () => {
return <div className={{#cssModules}}{classes.{{name}}}{{/cssModules}}{{^cssModules}}"{{name}}"{{/cssModules}}>{{name}} works!</div>;
};
{{#propTypes}}

{{name}}.propTypes = {
className: PropTypes.string,
};
{{/propTypes}}
10 changes: 10 additions & 0 deletions component/javascript/function/{{name}}.test.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import { {{name}} } from './{{name}}';

describe('{{name}}', () => {
it('should match snapshot', () => {
const { getByText } = render(<{{name}} />);
const linkElement = getByText(/{{name}} works!/i);
expect(linkElement).toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions component/typescript/class/index.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { {{name}} } from './{{name}}';
1 change: 1 addition & 0 deletions component/typescript/class/style.{{style}}.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.{{name}} {}
10 changes: 10 additions & 0 deletions component/typescript/class/{{name}}.test.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import { {{name}} } from './{{name}}';

describe('{{name}}', () => {
it('should match snapshot', () => {
const { getByText } = render(<{{name}} />);
const linkElement = getByText(/{{name}} works!/i);
expect(linkElement).toBeInTheDocument();
});
});
12 changes: 12 additions & 0 deletions component/typescript/class/{{name}}.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
{{#style}}
import {{#cssModules}}classes from {{/cssModules}}'./style.{{style}}';
{{/style}}

interface {{name}}Props {}

export class {{name}} extends React.Component<{{name}}Props> {
render() {
return <div className={{#cssModules}}{classes.{{name}}}{{/cssModules}}{{^cssModules}}"{{name}}"{{/cssModules}}>{{name}} works!</div>;
}
}
1 change: 1 addition & 0 deletions component/typescript/function/index.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { {{name}} } from './{{name}}';
1 change: 1 addition & 0 deletions component/typescript/function/style.{{style}}.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.{{name}} {}
10 changes: 10 additions & 0 deletions component/typescript/function/{{name}}.test.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import { {{name}} } from './{{name}}';

describe('{{name}}', () => {
it('should match snapshot', () => {
const { getByText } = render(<{{name}} />);
const linkElement = getByText(/{{name}} works!/i);
expect(linkElement).toBeInTheDocument();
});
});
10 changes: 10 additions & 0 deletions component/typescript/function/{{name}}.tsx.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type React from 'react';
{{#style}}
import {{#cssModules}}classes from {{/cssModules}}'./style.{{style}}';
{{/style}}

interface {{name}}Props {}

export const {{name}}: React.FC<{{name}}Props> = () => {
return <div className={{#cssModules}}{classes.{{name}}}{{/cssModules}}{{^cssModules}}"{{name}}"{{/cssModules}}>{{name}} works!</div>;
};

0 comments on commit 6d3d003

Please sign in to comment.