feat(html): Add Html component (#18)

* feat(html): Add `Html` component

* feat(html): Add `lang` prop

* fix(html): Description
This commit is contained in:
Bu Kinoshita
2022-09-22 11:45:43 -03:00
committed by GitHub
parent 47bd343125
commit b41488e51f
7 changed files with 122 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom'],
};
+8
View File
@@ -0,0 +1,8 @@
Copyright 2022 Bu Kinoshita and Zeno Rocha
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+32
View File
@@ -0,0 +1,32 @@
{
"name": "@react-email/html",
"version": "0.0.1",
"description": "A React html component to wrap emails",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
],
"license": "MIT",
"scripts": {
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
"dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch",
"lint": "TIMING=1 eslint src/**/*.ts* --fix",
"clean": "rm -rf dist"
},
"devDependencies": {
"@types/react": "18.0.20",
"@types/react-dom": "18.0.6",
"eslint": "8.23.1",
"eslint-config-custom": "*",
"react": "18.2.0",
"tsconfig": "*",
"tsup": "6.2.3",
"typescript": "4.8.3"
},
"publishConfig": {
"access": "public"
}
}
+51
View File
@@ -0,0 +1,51 @@
![React Email HTML cover](https://react-email-assets.vercel.app/html.png)
<div align="center"><strong>@react-email/html</strong></div>
<div align="center">A React html component to wrap emails.</div>
<br />
<div align="center">
<a href="https://react.email">Website</a>
<span> · </span>
<a href="https://react.email">Documentation</a>
<span> · </span>
<a href="https://react.email">Twitter</a>
</div>
## Install
Install component from your command line.
#### With yarn
```sh
yarn add @react-email/html -E
```
#### With npm
```sh
npm install @react-email/html -E
```
## Getting started
Add the component to your email template. Include styles where needed.
```jsx
import { Button } from '@react-email/button';
import { Html } from '@react-email/html';
const Email = () => {
return (
<Html lang="en">
<Button href="https://example.com" style={{ color: '#61dafb' }}>
Click me
</Button>
</Html>
);
};
```
## License
MIT License
+18
View File
@@ -0,0 +1,18 @@
import * as React from 'react';
type RootProps = React.ComponentPropsWithoutRef<'html'>;
export interface HtmlProps extends RootProps {}
export const Html: React.FC<Readonly<HtmlProps>> = ({
children,
lang = 'en',
style,
...props
}) => (
<html lang={lang} {...props}>
{children}
</html>
);
Html.displayName = 'Html';
+1
View File
@@ -0,0 +1 @@
export * from './html';
+8
View File
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"lib": ["dom", "ES2015"]
},
"extends": "tsconfig/react-library.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}