-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection_experience.go
More file actions
80 lines (70 loc) · 1.55 KB
/
section_experience.go
File metadata and controls
80 lines (70 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package cvgen
import (
"log"
"github.com/ananrafs/cvgen/text"
)
// ExperienceSection represents the experience section
type ExperienceSection struct {
WorkExperiences []WorkExperience
}
type WorkExperience struct {
Period Period
Company string
Role string
JobDesc []string
}
// Render renders the experience section as a string
func (e ExperienceSection) Render(w PDFWriter) {
CommonRenderTitle("Work Experience", w)
widthRatio, err := getWidth(w.GetWidth()-(2*w.GetMargin()), 70, 30)
if err != nil {
log.Fatal(err)
}
for _, we := range e.WorkExperiences {
j := 0
for {
margin := w.GetMargin()
_, currY := w.GetPosition()
for _, width := range widthRatio {
switch j {
case 0:
w.SetPosition(margin, currY)
w.Write(
we.Company,
text.WithStyle(text.Title),
text.WithWidth(margin, w.GetWidth()-w.GetMargin()),
)
case 1:
w.SetPosition(margin, currY)
w.Write(
we.Period.String(),
text.WithAlign(text.Right),
text.WithStyle(text.ContentBold),
text.WithWidth(margin, w.GetWidth()-w.GetMargin()),
)
case 2:
w.Write(
we.Role,
text.WithStyle(text.Subtitle),
text.WithWidth(margin, w.GetWidth()-w.GetMargin()),
)
}
margin += width
j++
}
if j > 2 {
break
}
}
for _, jd := range we.JobDesc {
_, currY := w.GetPosition()
w.SetPosition(2*w.GetMargin(), currY)
w.Write("-")
w.SetPosition(0, currY)
w.Write(jd,
text.WithWidth(2*w.GetMargin()+10, w.GetWidth()-w.GetMargin()),
)
}
w.Next()
}
}