Skip to content

Instantly share code, notes, and snippets.

View mxro's full-sized avatar

Max Rohde mxro

View GitHub Profile
@mxro
mxro / react1.tsx
Last active October 20, 2022 19:53
react1.tsx
import React from 'react';
import { SSRHandler } from '@goldstack/template-ssr';
import { renderPage, hydrate } from './../render';
const Posts = (props: { posts: string[] }): JSX.Element => {
return (
<>
<p>Posts:</p>
{props.posts.map((p, idx) => (
return <div className={styles.myclass}></div>;
import React from 'react';
import styles from './MyComponent.module.css';
.myclass {
padding: 10px;
}
@mxro
mxro / build.ts
Created August 17, 2022 20:23
build.ts
import { build } from 'esbuild';
import cssServerPlugin from 'esbuild-css-modules-server-plugin';
import cssPlugin from 'esbuild-css-modules-client-plugin';
const generatedCss: string[] = [];
const res = await build({
plugins: [
cssServerPlugin({
onCSSGenerated: (css) => {
generatedCss.push(css);
},
import { build } from 'esbuild';
import cssPlugin from 'esbuild-css-modules-client-plugin';
const res = await build({
plugins: [
cssPlugin({
excludeCSSInject: true,
}),
],
});
import { build } from 'esbuild';
import cssPlugin from 'esbuild-css-modules-client-plugin';
const res = await build({
plugins: [cssPlugin()],
});
import { build } from 'esbuild';
import cssServerPlugin from 'esbuild-css-modules-server-plugin';
const generatedCss: string[] = [];
const res = await build({
plugins: [
cssServerPlugin({
onCSSGenerated: (css) => {
generatedCss.push(css);
},
}),
const table = await connectTable();
const Users = UserEntity(table);
await Users.put({
pk: '[email protected]',
sk: 'admin',
name: 'Joe',
emailVerified: true,
});
export function UserEntity<Name extends string>(
table: Table<Name, 'pk', 'sk'>
): Entity<User, UserKey, typeof table> {
const e = new Entity<User, UserKey, typeof table>({
name: 'User',
attributes: {
pk: { partitionKey: true },
sk: { hidden: true, sortKey: true },
name: { type: 'string', required: true },
emailVerified: { type: 'boolean', required: true },