Skip to content

Commit

Permalink
refactor: move the mjml templates to the ui dir
Browse files Browse the repository at this point in the history
  • Loading branch information
huwshimi committed Sep 23, 2024
1 parent 24022e8 commit 8c7bfad
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 17 deletions.
8 changes: 0 additions & 8 deletions internal/mail/.mjmlconfig

This file was deleted.

8 changes: 0 additions & 8 deletions internal/mail/Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions ui/emails/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MJML=npx mjml
MJML_DIR=mjml
MJML_FILES=$(wildcard $(MJML_DIR)/*.mjml)
IMAGES_DIR_NAME=images
MJML_IMAGES=$(MJML_DIR)/$(IMAGES_DIR_NAME)
HTML_DIR=../../internal/mail/html
IMAGES_DIR=$(HTML_DIR)/$(IMAGES_DIR_NAME)

images:
rsync -a --delete $(MJML_IMAGES)/ $(IMAGES_DIR)

.PHONY=images

build: $(MJML_FILES) images
$(foreach file, $(MJML_FILES), $(MJML) $(file) --config.minify --config.minifyOptions='{"minifyCSS": true}' -o $(HTML_DIR)/$(basename $(notdir $(file))).html;)

.PHONY=build
5 changes: 4 additions & 1 deletion internal/mail/README.md → ui/emails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ All templates in the `mjml` directory can be built by running the following comm

```
make build
```
```

This will build all templates to the `internal/mail/html` directory and sync the
images.
Binary file added ui/emails/mjml/images/canonical.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions ui/emails/mjml/includes/header.mjml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<mj-section background-color="#242424" padding="0 0 20px 32px">
<mj-column>
<mj-image
padding="0"
align="left"
width="130px"
src="./images/canonical.jpg"
></mj-image>
</mj-column>
</mj-section>
64 changes: 64 additions & 0 deletions ui/emails/mjml/user-invite.mjml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<mjml>
<mj-head>
<mj-attributes>
<mj-text padding="0" />
<mj-class name="h4" font-size="24px" font-weight="275" />
<mj-all font-family="'Ubuntu variable', Ubuntu, Arial, 'libra sans', sans-serif" font-size="16px" color="#000" font-weight="300" line-height="24px" />
</mj-attributes>
<mj-style>
<!-- Test -->
@font-face {
font-family: 'Ubuntu variable';
font-stretch: 100%;
font-style: normal;
font-weight: 100 800;
src: url('https://assets.ubuntu.com/v1/f1ea362b-Ubuntu%5Bwdth,wght%5D-latin-v0.896a.woff2') format('woff2-variations');
}
</mj-style>
</mj-head>
<!-- test -->
<mj-body background-color="#F3F4F8">
<mj-wrapper>
<mj-include path="./includes/header.mjml" />
<mj-section padding="32px" padding-bottom="12px" background-color="#fff">
<mj-column>
<mj-text mj-class="h4">Verify your account</mj-text>
</mj-column>
</mj-section>
<mj-section padding="32px" background-color="#fff">
<mj-column width="30%" padding="0px">
<mj-text font-weight="400">Account</mj-text>
</mj-column>
<mj-column width="70%">
<mj-text>{{ .Email }}</mj-text>
</mj-column>
</mj-section>
<mj-section padding="0 32px 32px 32px" background-color="#fff">
<mj-column width="30%">
<mj-text font-weight="400">Verification code</mj-text>
</mj-column>
<mj-column width="70%">
<mj-text font-size="32px">{{ .RecoveryCode }}</mj-text>
</mj-column>
</mj-section>
<mj-section padding="0 32px 32px 32px" background-color="#fff">
<mj-column>
<mj-divider padding-left="0" padding-right="0" border-color="#e6e6e6" border-width="1px" padding-top="0"></mj-divider>
<mj-button align="left" border-radius="0" background-color="#0C8420" color="#fff" href="{{ .InviteUrl }}" padding-left="0" padding-right="0">
Verify your account
</mj-button>
<mj-text>or click this link</mj-text>
<mj-text><a style="color: #0066cc; text-decoration: none" href="{{ .InviteUrl }}">{{ .InviteUrl }}</a></mj-text>
</mj-column>
</mj-section>
<mj-section padding="32px" background-color="#F7F7F7">
<mj-column>
<mj-text font-size="14px" color="#666666">You are receiving this email because you are a user of Canonical
Identity Platform.</mj-text>
<mj-text font-size="14px" color="#666666">If you're not sure why you're receiving this please contact
support.</mj-text>
</mj-column>
</mj-section>
</mj-wrapper>
</mj-body>
</mjml>

0 comments on commit 8c7bfad

Please sign in to comment.