Skip to content

Commit

Permalink
Merge pull request #5 from arskang/feature/coupon
Browse files Browse the repository at this point in the history
Feature/coupon
  • Loading branch information
arskang authored Nov 5, 2021
2 parents 8ff66e5 + e263b34 commit aafe75f
Show file tree
Hide file tree
Showing 28 changed files with 568 additions and 63 deletions.
19 changes: 15 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- FontSize ```acorntypes.FontSize```
- CouponParams ```acorntypes.CouponParams```
- PromoItems ```acorntypes.PromoItems```
- PromoParams ```acorntypes.PromoParams```
- CouponStyles ```acorntypes.CouponStyles```
- GetSizes
- NewAcornSize
- GetAligns
- NewCoupon
- NewPromo
- Carpeta con ejemplos
- Documentación a los métodos
- Archivo **.editorconfig**
- Archivo **CHANGELOG.md**

### Changed

- La importación cambia a github.com/arskang/acornmail
- Se optimizaron las imagenes con ejemplos en el **README.md**
- Se renombró la carpeta **assets** por **_assets** para que golang no lo importe

### Deprecated
### Removed

- ```acorntypes.LabelStyles.Type``` usar mejor ```acorntypes.LabelStyles.Outlined``` (se elimina en la próxima versión menor)
- ```acorntypes.LabelStyles.Type``` usar mejor ```acorntypes.LabelStyles.Outlined```

## [1.0.0-beta] - 2021-10-23

Expand Down Expand Up @@ -80,5 +91,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Archivo **LICENSE**
- Archivo **README.md**

[unreleased]: https://github.com/arskang/gomail-acorn-template/tree/develop
[1.0.0-beta]: https://github.com/arskang/gomail-acorn-template/releases/tag/v1.0.0-beta
[unreleased]: https://github.com/arskang/acornmail/tree/develop
[1.0.0-beta]: https://github.com/arskang/acornmail/releases/tag/v1.0.0-beta
199 changes: 184 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<!-- img src="https://d3vv6lp55qjaqc.cloudfront.net/items/1L1w0v431V0d1K410f3Y/keepAChangelog-logo-dark.svg" height=150 alt="Keep a Changelog" / -->

[![Go Report Card](https://goreportcard.com/badge/github.com/arskang/gomail-acorn-template)](https://goreportcard.com/report/github.com/arskang/gomail-acorn-template)
[![GoDoc](https://pkg.go.dev/badge/github.com/arskang/gomail-acorn-template?status.svg)](https://pkg.go.dev/github.com/arskang/gomail-acorn-template?tab=doc)
[![Release](https://img.shields.io/github/release/arskang/gomail-acorn-template.svg?style=flat-square)](https://github.com/arskang/gomail-acorn-template/releases)
[![Go Report Card](https://goreportcard.com/badge/github.com/arskang/acornmail)](https://goreportcard.com/report/github.com/arskang/acornmail)
[![GoDoc](https://pkg.go.dev/badge/github.com/arskang/acornmail?status.svg)](https://pkg.go.dev/github.com/arskang/acornmail?tab=doc)
[![Release](https://img.shields.io/github/release/arskang/acornmail.svg?style=flat-square)](https://github.com/arskang/acornmail/releases)
[![MIT License Badge](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![Keep a Changelog v1.1.0 badge](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.1.0-%23E05735)](./CHANGELOG.md)

Expand All @@ -29,18 +29,18 @@ Colores:

#### Instalación
```
go get -u github.com/arskang/gomail-acorn-template
go get -u github.com/arskang/acornmail
```

#### Importación
```go
import acornmail "github.com/arskang/gomail-acorn-template"
import "github.com/arskang/acornmail"
```

#### Ejemplo
Más ejemplos [aquí](./_examples/README.md)
Más ejemplos [aquí](./_examples/)
```go
import acornmail "github.com/arskang/gomail-acorn-template"
import "github.com/arskang/acornmail"

func main() {

Expand Down Expand Up @@ -193,7 +193,7 @@ labelFilled := acorn.NewLabel(&acorntypes.LabelParams{
labelOutlined := acorn.NewLabel(&acorntypes.LabelParams{
Text: "outlined label",
Styles: &acorntypes.LabelStyles{
Type: types.Outlined,
Outlined: true,
},
})

Expand Down Expand Up @@ -301,17 +301,13 @@ fmt.Println(boilerplate)

- *Content*
```go
acorn := acornmail.NewAcornEmailComponents()

content := acorn.NewContent(&acorntypes.ContentParams{
Content: row,
Image: "https://picsum.photos/1200/800?image=837",
})

// Without image
// content := acorn.NewContent(&acorntypes.ContentParams{
// Content: row,
// })

boilerplate := acorn.GetBoilerplate(
acorntypes.AcornComponents{content},
acornstyles.WithoutMargins(),
Expand All @@ -320,6 +316,21 @@ boilerplate := acorn.GetBoilerplate(
fmt.Println(boilerplate)
```
![Content](./_assets/components-content.png)

```go
acorn := acornmail.NewAcornEmailComponents()

content := acorn.NewContent(&acorntypes.ContentParams{
Content: row,
})

boilerplate := acorn.GetBoilerplate(
acorntypes.AcornComponents{content},
acornstyles.WithoutMargins(),
)

fmt.Println(boilerplate)
```
![Content](./_assets/components-content-withoutimage.png)

- **Alerts**
Expand Down Expand Up @@ -515,11 +526,144 @@ fmt.Println(boilerplate)
```
![Testimonial](./_assets/components-testimonial.png)

- **Promo**
```go
acorn := acornmail.NewAcornEmailComponents()

promo := acorn.NewPromo(&acorntypes.PromoItems{
Promo: &acorntypes.PromoParams{Value: "25"},
Symbol: &acorntypes.PromoParams{Value: "%"},
Description: &acorntypes.PromoParams{Value: "OFF"},
})

boilerplate := acorn.GetBoilerplate(acorntypes.AcornComponents{
promo,
}, nil)
```
![Promo default](./_assets/components-promo01.png)

```go
acorn := acornmail.NewAcornEmailComponents()
sizes := acornstyles.GetSizes()

promo := acorn.NewPromo(&acorntypes.PromoItems{
Promo: &acorntypes.PromoParams{
Value: "25",
Size: sizes.PX108,
},
Symbol: &acorntypes.PromoParams{
Value: "%",
Color: acornstyles.GetColors().Green.M700,
Size: sizes.PX36,
},
Description: &acorntypes.PromoParams{
Value: "OFF",
Size: sizes.PX24,
},
})

boilerplate := acorn.GetBoilerplate(acorntypes.AcornComponents{
promo,
}, nil)
```
![Promo custom](./_assets/components-promo02.png)

- **Coupon**
```go
acorn := acornmail.NewAcornEmailComponents()

color := acornstyles.GetColors()
aligns := acornstyles.GetAligns()

coupon := acorn.NewCoupon(&acorntypes.CouponParams{
Content: acorn.NewGrid([][]*acorntypes.ColumnParams{
{{
Content: `
<div style="font-size: 13px; text-transform: uppercase;">¡Gracias por registrarte!<br>Disfruta</div>
<div style="font-size: 72px; font-weight: 700; line-height: 100%;">$10 DESC</div>
<div class="spacer py-sm-8" style="line-height: 16px;">‌</div>
<div style="font-size: 20px; letter-spacing: 2px; line-height: 100%; text-transform: uppercase;">En tu primera compra</div>
`,
Styles: &acorntypes.ColumnStyles{
Align: aligns.Center,
TextColor: color.White,
},
}},
nil,
}),
Button: &acorntypes.ButtonParams{
Text: "COMPRA AHORA",
Styles: &acorntypes.ButtonStyles{
Color: color.White,
TextColor: color.Blue.M500,
Align: aligns.Center,
},
},
})

boilerplate := acorn.GetBoilerplate(acorntypes.AcornComponents{
coupon,
}, acornstyles.WithoutMargins())
```
![Coupon default](./_assets/components-coupon01.png)

```go
acorn := acornmail.NewAcornEmailComponents()

color := acornstyles.GetColors()
aligns := acornstyles.GetAligns()

promo := acorn.NewPromo(&acorntypes.PromoItems{
Promo: &acorntypes.PromoParams{Value: "25"},
Symbol: &acorntypes.PromoParams{Value: "%"},
Description: &acorntypes.PromoParams{Value: "DESC"},
})

label := acorn.NewLabel(&acorntypes.LabelParams{
Text: "25OFFTODAY",
Styles: &acorntypes.LabelStyles{
Outlined: true,
TextColor: color.Red.M500,
Color: color.Red.M500,
},
})

coupon := acorn.NewCoupon(&acorntypes.CouponParams{
Content: acorn.NewGrid([][]*acorntypes.ColumnParams{
{{Content: promo}},
{{
Content: `Con el cupón ` + label,
Styles: &acorntypes.ColumnStyles{
Align: aligns.Center,
TextColor: color.Grey.M400,
},
}},
nil,
}),
Button: &acorntypes.ButtonParams{
Text: "Canjear cupón →",
Styles: &acorntypes.ButtonStyles{
Color: color.Black,
TextColor: color.White,
Align: aligns.Center,
},
},
Styles: &acorntypes.CouponStyles{
Dashed: true,
},
})

boilerplate := acorn.GetBoilerplate(acorntypes.AcornComponents{
coupon,
}, acornstyles.WithoutMargins())
```
![Coupon dashed](./_assets/components-coupon02.png)

#### Tipos

- *Importación*
```go
import "github.com/arskang/gomail-acorn-template/acorntypes"
import "github.com/arskang/acornmail/acorntypes"
```

- *Básicos*
Expand All @@ -530,6 +674,7 @@ import "github.com/arskang/gomail-acorn-template/acorntypes"
- Types ```acorntypes.Types```
- AcornComponents ```acorntypes.AcornComponents```
- AcornVariables ```acorntypes.AcornVariables```
- FontSize ```acorntypes.FontSize```

- *Compuestos*

Expand All @@ -548,12 +693,16 @@ import "github.com/arskang/gomail-acorn-template/acorntypes"
- TestimonialParams ```acorntypes.TestimonialParams```
- TestimonialStyles ```acorntypes.TestimonialStyles```
- ImageParams ```acorntypes.ImageParams```
- CouponParams ```acorntypes.CouponParams```
- PromoItems ```acorntypes.PromoItems```
- PromoParams ```acorntypes.PromoParams```
- CouponStyles ```acorntypes.CouponStyles```

#### Estilos

- *Importación*
```go
import "github.com/arskang/gomail-acorn-template/acornstyles"
import "github.com/arskang/acornmail/acornstyles"
```

- *Tipo de botones*
Expand All @@ -574,6 +723,26 @@ fmt.Println(aligns.Right)
fmt.Println(aligns.Left)
```

- *Tamaños de letra*

```go
sizes := acornstyles.GetSizes()
fmt.Println(sizes.Px12)
fmt.Println(sizes.Px24)
fmt.Println(sizes.Px36)
fmt.Println(sizes.Px48)
fmt.Println(sizes.Px60)
fmt.Println(sizes.Px72)
fmt.Println(sizes.Px84)
fmt.Println(sizes.Px96)
fmt.Println(sizes.Px108)
fmt.Println(sizes.Px120)

customSize := acornstyles.NewAcornSize(10)
fmt.Println(customSize)
// 10px
```

- *Ancho de columnas*

```go
Expand Down
Binary file added _assets/components-coupon01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/components-coupon02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/components-promo01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/components-promo02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions _examples/basic_template.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package examples

import (
acornmail "github.com/arskang/gomail-acorn-template"
"github.com/arskang/gomail-acorn-template/acornstyles"
"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail"
"github.com/arskang/acornmail/acornstyles"
"github.com/arskang/acornmail/acorntypes"
)

type Colors struct {
Expand Down
4 changes: 2 additions & 2 deletions acorn/accordion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package acorn
import (
"strings"

"github.com/arskang/gomail-acorn-template/acornstyles"
"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail/acornstyles"
"github.com/arskang/acornmail/acorntypes"
)

type accordion struct {
Expand Down
4 changes: 2 additions & 2 deletions acorn/alerts.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package acorn

import (
"github.com/arskang/gomail-acorn-template/acornstyles"
"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail/acornstyles"
"github.com/arskang/acornmail/acorntypes"
)

type alert struct {
Expand Down
2 changes: 1 addition & 1 deletion acorn/boilerplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package acorn
import (
"strings"

"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail/acorntypes"
)

// Generate a new boilerplate html element
Expand Down
4 changes: 2 additions & 2 deletions acorn/buttons.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package acorn

import (
"github.com/arskang/gomail-acorn-template/acornstyles"
"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail/acornstyles"
"github.com/arskang/acornmail/acorntypes"
)

type button struct {
Expand Down
4 changes: 2 additions & 2 deletions acorn/content.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package acorn

import (
"github.com/arskang/gomail-acorn-template/acornstyles"
"github.com/arskang/gomail-acorn-template/acorntypes"
"github.com/arskang/acornmail/acornstyles"
"github.com/arskang/acornmail/acorntypes"
)

// Generate a new content html element
Expand Down
Loading

0 comments on commit aafe75f

Please sign in to comment.