Skip to content

Commit

Permalink
remove forward refs, adjust types, change imports in demos
Browse files Browse the repository at this point in the history
  • Loading branch information
devjmetivier committed Sep 27, 2023
1 parent 98c37fb commit b23dae4
Show file tree
Hide file tree
Showing 39 changed files with 278 additions and 313 deletions.
2 changes: 1 addition & 1 deletion apps/demo/emails/airbnb-review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface AirbnbReviewEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/amazon-review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface AmazonReviewEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/apple-receipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : '';
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/codepen-challengers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Section,
Text,
Row
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : '';
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/dropbox-reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface DropboxResetPasswordEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/github-access-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface GithubAccessTokenEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/google-play-policy-update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : '';
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/koala-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface KoalaWelcomeEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/linear-login-code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface LinearLoginCodeEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/netlify-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Section,
Tailwind,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface NetlifyWelcomeEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/nike-receipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : '';
Expand Down
12 changes: 1 addition & 11 deletions apps/demo/emails/notion-magic-link.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
Body,
Container,
Head,
Heading,
Html,
Img,
Link,
Preview,
Text
} from '@jsx-email/components';
import { Body, Container, Head, Heading, Html, Img, Link, Preview, Text } from '@jsx-email/all';
import * as React from 'react';

interface NotionMagicLinkEmailProps {
Expand Down
12 changes: 1 addition & 11 deletions apps/demo/emails/plaid-verify-identity.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
Body,
Container,
Head,
Heading,
Html,
Img,
Link,
Section,
Text
} from '@jsx-email/components';
import { Body, Container, Head, Heading, Html, Img, Link, Section, Text } from '@jsx-email/all';
import * as React from 'react';

interface PlaidVerifyIdentityEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/raycast-magic-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface RaycastMagicLinkEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/slack-confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface SlackConfirmEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/stack-overflow-tips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Section,
Text,
Row
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface StackOverflowTipsEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/stripe-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Preview,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : '';
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/twitch-reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface TwitchResetPasswordEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/vercel-invite-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Section,
Tailwind,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface VercelInviteUserEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/emails/yelp-recent-login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Row,
Section,
Text
} from '@jsx-email/components';
} from '@jsx-email/all';
import * as React from 'react';

interface YelpRecentLoginEmailProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/body/src/body.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import type React from 'react';

type RootProps = React.ComponentPropsWithoutRef<'body'>;

Expand Down
67 changes: 32 additions & 35 deletions packages/button/src/button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react';
import type React from 'react';

import { pxToPt, parsePadding } from './utils';

type ButtonElement = React.ElementRef<'a'>;
type RootProps = React.ComponentPropsWithoutRef<'a'>;

export interface ButtonProps extends RootProps {
Expand Down Expand Up @@ -40,40 +39,38 @@ const buttonTextStyle = (pb?: number) => {
};
};

export const Button = React.forwardRef<ButtonElement, Readonly<ButtonProps>>(
({ children, style, target = '_blank', ...props }, forwardedRef) => {
const { pt, pr, pb, pl } = parsePadding({
padding: style?.padding,
paddingBottom: style?.paddingBottom,
paddingLeft: style?.paddingLeft,
paddingRight: style?.paddingRight,
paddingTop: style?.paddingTop
});
export const Button: React.FC<Readonly<ButtonProps>> = ({
children,
style,
target = '_blank',
...props
}) => {
const { pt, pr, pb, pl } = parsePadding({
padding: style?.padding,
paddingBottom: style?.paddingBottom,
paddingLeft: style?.paddingLeft,
paddingRight: style?.paddingRight,
paddingTop: style?.paddingTop
});

const y = pt + pb;
const textRaise = pxToPt(y);
const y = pt + pb;
const textRaise = pxToPt(y);

return (
<a
{...props}
ref={forwardedRef}
target={target}
style={buttonStyle({ ...style, pb, pl, pr, pt })}
>
<span
dangerouslySetInnerHTML={{
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden>&nbsp;</i><![endif]-->`
}}
/>
<span style={buttonTextStyle(pb)}>{children}</span>
<span
dangerouslySetInnerHTML={{
__html: `<!--[if mso]><i style="letter-spacing: ${pr}px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
}}
/>
</a>
);
}
);
return (
<a {...props} target={target} style={buttonStyle({ ...style, pb, pl, pr, pt })}>
<span
dangerouslySetInnerHTML={{
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden>&nbsp;</i><![endif]-->`
}}
/>
<span style={buttonTextStyle(pb)}>{children}</span>
<span
dangerouslySetInnerHTML={{
__html: `<!--[if mso]><i style="letter-spacing: ${pr}px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
}}
/>
</a>
);
};

Button.displayName = 'Button';
22 changes: 17 additions & 5 deletions packages/cli/app/src/css/globals.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
@import url(https://fonts.bunny.net/css?family=andika:400,400i,700,700i|inter:400,600|montserrat:100,200,300,400,500,600);
@import './monokai4.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
html, body {
font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
html,
body {
font-family:
'Montserrat',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Helvetica,
Arial,
sans-serif,
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol';
}

.shiki {
Expand All @@ -27,11 +37,13 @@
white-space: pre;
}

.shiki .line:last-child:before, .shiki .line:last-child span {
.shiki .line:last-child:before,
.shiki .line:last-child span {
padding-bottom: 30px;
}

.shiki .line:first-child:before, .shiki .line:first-child span {
.shiki .line:first-child:before,
.shiki .line:first-child span {
padding-top: 10px;
}

Expand Down
17 changes: 9 additions & 8 deletions packages/column/src/column.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import * as React from 'react';
import type React from 'react';

type ColumnElement = React.ElementRef<'td'>;
type RootProps = React.ComponentPropsWithoutRef<'td'>;

export interface ColumnProps extends RootProps {}

export const Column = React.forwardRef<ColumnElement, Readonly<ColumnProps>>(
({ children, style, ...props }, forwardedRef) => (
<td {...props} ref={forwardedRef} data-id="@jsx-email/column" style={style}>
{children}
</td>
)
export const Column = ({
children,
style,
...props
}: React.PropsWithChildren<Readonly<ColumnProps>>) => (
<td {...props} data-id="@jsx-email/column" style={style}>
{children}
</td>
);

Column.displayName = 'Column';
Loading

0 comments on commit b23dae4

Please sign in to comment.