diff --git a/2 b/2 new file mode 100644 index 0000000..b068184 --- /dev/null +++ b/2 @@ -0,0 +1,84 @@ +package page + +import "github.com/lorenzhohermuth/portfolio/view/layout" +import "github.com/lorenzhohermuth/portfolio/view/component" + +templ ShowHome(arr []component.CarouselEntry, index int, events []component.Event) { + @layout.Base(){ +
+
+

+ About this Website +

+

+ The Purpose of this website is to try a new Stack with GO and HTMX with the goal of using a Minimal amount of Code. + And to refresh my old Portfolio to a newer State. +

+
+ +
+ @component.Banner("Stack", "", "#6266ec", "#b9f301" ) +
+ +
+
+ +
+ +
+ Language +
+
+ GO +
+ +
+ HTMX +
+
+ Frontend Famework +
+ +
+ CSS Famework +
+
+ Uno CSS +
+ +
+ Templ +
+
+ HTML Templating +
+ +
+ HTTP Famework +
+
+ Echo +
+ +
+
+
+
+ +
+ @component.Banner("Porjects", "󰣪", "#b9f301", "#ff5cdb") +
+ @component.Carousel(arr, index) +
+
+ +
+ @component.Banner("Work", "", "#1733d2", "#ff5cdb") +
+
+ @component.Timeline(events) +
+
+
+ } +} diff --git a/internal/mdparser/projects.go b/internal/mdparser/projects.go new file mode 100644 index 0000000..69be2a0 --- /dev/null +++ b/internal/mdparser/projects.go @@ -0,0 +1,73 @@ +package mdparser + +import ( + "context" + "regexp" + "strings" + + "github.com/lorenzhohermuth/portfolio/pkg/github" + "github.com/lorenzhohermuth/portfolio/view/component" +) + +func GetProjects() []component.CarouselEntry { + projectsFile, ghErr := github.FetchGHFile(context.Background(), "/interactive/projects.md") + if ghErr != nil { + panic(ghErr) + } + components := make([]component.CarouselEntry, 0) + + lines := strings.Split(projectsFile, "\n") + tmpTitle := "" + tmpText := "" + tmpImg := "" + for _, l := range lines { + isFilled, elm := parseMdProject(l, &tmpTitle, &tmpText, &tmpImg) + if isFilled { + components = append(components, elm) + } + } + + return components +} + +func getChar(text string, pos int) string { + text = strings.TrimSpace(text) + if text == "" { + return "" + } + return string([]rune(text)[pos]) +} + +func parseMdProject(line string, title *string, text *string, img *string) (bool, component.CarouselEntry){ + char := getChar(line, 0) + + if char == "" { + elm := component.CarouselEntry{ + ImgPath: *img, + Title: *title, + Text: *text, + } + *img = "" + *title = "" + *text = "" + return true, elm + + } else if char == "#" { + *title = strings.TrimSpace(line[1:]) + + } else if char == "!" { + rgx := regexp.MustCompile(`\((.*?)\)`) + mdImage := rgx.FindStringSubmatch(line)[1] + mdImage = strings.TrimSpace(mdImage) + + if mdImage[:4] != "http" { + mdImage = strings.Replace(mdImage, "assets", "static", 1) + } + + *img = mdImage + + } else { + *text += line + } + return false, component.CarouselEntry{} +} diff --git a/internal/mdparser/work.go b/internal/mdparser/work.go new file mode 100644 index 0000000..20e2b2e --- /dev/null +++ b/internal/mdparser/work.go @@ -0,0 +1,49 @@ +package mdparser + +import ( + "context" + "strings" + + "github.com/lorenzhohermuth/portfolio/pkg/github" + "github.com/lorenzhohermuth/portfolio/view/component" +) + +func GetWork() []component.Event { + projectsFile, ghErr := github.FetchGHFile(context.Background(), "/interactive/work.md") + if ghErr != nil { + panic(ghErr) + } + components := make([]component.Event, 0) + + lines := strings.Split(projectsFile, "\n") + tmpTitle := "" + tmpPeriod := "" + for _, l := range lines { + isFilled, elm := parseMdWork(l, &tmpTitle, &tmpPeriod) + if isFilled { + components = append(components, elm) + } + } + + return components +} + +func parseMdWork(line string, title *string, periode *string) (bool, component.Event){ + char := getChar(line, 0) + + if char == "" { + elm := component.Event{ + TimePeriode: *periode, + Title: *title, + } + *title = "" + *periode = "" + return true, elm + + } else if char == "#" { + *title = strings.TrimSpace(line[1:]) + } else { + *periode = line + } + return false, component.Event{} +} diff --git a/view/component/carousel.templ b/view/component/carousel.templ index 9e9a824..081888f 100644 --- a/view/component/carousel.templ +++ b/view/component/carousel.templ @@ -17,7 +17,7 @@ func getEntry(arr []CarouselEntry, index int) CarouselEntry { templ Carousel(elm []CarouselEntry , index int) {