Skip to content

Commit

Permalink
MVP aka Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Muravya committed Jan 18, 2021
1 parent 97c2563 commit cd150c6
Show file tree
Hide file tree
Showing 23 changed files with 314 additions and 14 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Created by [Krita](https://krita.org).
* Canvas should have size `160x44`.
* Use white background and eraser.
* At top rib select `Brush Settings` -> `Text`. Branch preset should be `Eraser` (Second option)
* Font used `Non Sans Arabic UI Md, 18`
* Font used `Source Sans Pro Black, 22`
* Save as png: compression: `1`
* Encode given png to base64. Using [base64-image.de](https://www.base64-image.de/)
* Embed it to html

## About:icons
Icons are resized using [resizeimage.net](https://resizeimage.net/)

Logos are taken from [IconNinja](https://www.iconninja.com/)
4 changes: 0 additions & 4 deletions frontend/css/main_view.css

This file was deleted.

6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Emoji Pack -->
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/io/kyberorg/whoami/Emoji.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.kyberorg.whoami;

public class Emoji {
public static final String LOVE = "❤️";
public static final String CROSS = "❌";
public static final String FOREST = "\uD83C\uDF32";
public static final String ESTONIA = "\uD83C\uDDEA\uD83C\uDDEA";
}
11 changes: 11 additions & 0 deletions src/main/java/io/kyberorg/whoami/elements/Divider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.kyberorg.whoami.elements;

import com.vaadin.flow.component.html.Hr;

public class Divider extends Hr {
public Divider() {
getStyle().set("background-image", "#f5f9ff");
getStyle().set("flex", "0 0 2px");
getStyle().set("align-self", "stretch");
}
}
59 changes: 59 additions & 0 deletions src/main/java/io/kyberorg/whoami/elements/Logo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.kyberorg.whoami.elements;

import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.html.Image;
import org.apache.commons.lang3.StringUtils;

@Tag("img")
public class Logo extends Image {
public static Builder create() {
return new Builder();
}

private Logo(String source, String alt, String url) {
getStyle().set("margin", "0.5rem");
if(StringUtils.isNotBlank(source)) {
setSrc(source);
}

if (StringUtils.isNotBlank(alt)) {
setAlt(alt);
}

if(StringUtils.isNotBlank(url)) {
addClickListener(event -> UI.getCurrent().getPage().setLocation(url));
getStyle().set("cursor","pointer");
}
}

public Logo roundLogo() {
getStyle().set("borderRadius", "25%");
return this;
}

public static class Builder {
private String source;
private String altText;
private String url;

public Builder withSource(String imageSource) {
this.source = imageSource;
return this;
}

public Builder withAltText(String alternativeText) {
this.altText = alternativeText;
return this;
}

public Builder withUrl(String url) {
this.url = url;
return this;
}

public Logo build() {
return new Logo(source, altText, url);
}
}
}
43 changes: 35 additions & 8 deletions src/main/java/io/kyberorg/whoami/ui/MainView.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.kyberorg.whoami.ui;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.H3;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.component.page.Viewport;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.InitialPageSettings;
import com.vaadin.flow.server.PWA;
Expand All @@ -15,6 +15,7 @@
import com.vaadin.flow.spring.annotation.UIScope;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;
import io.kyberorg.whoami.ui.sections.*;

@SpringComponent
@UIScope
Expand All @@ -27,22 +28,48 @@
offlineResources = {"images/logo.jpg"},
description = "WhoAmI: site about @kyberorg")
@Theme(value = Lumo.class, variant = Lumo.DARK)
@CssImport("./css/main_view.css")
@PageTitle("Kyberorg.io")
@Route("")
public class MainView extends VerticalLayout implements PageConfigurator {

public MainView() {
H2 title = new H2("Hello, I am kyberorg");
H3 subTitle = new H3("Soon here will some useful content. See again soon...");
Component titleSection = TitleSection.getInstance();

Section aboutSection = Section.create()
.withTitle("Who Am I? (About Me)")
.andContent(new AboutSection())
.build();

Section socialSection = Section.create()
.withTitle("Where Am I? (Social Network Accounts)")
.andContent(new SocialSection())
.build();

Section myProjectSection = Section.create()
.withTitle("What I do? (My Projects)")
.andContent(new ProjectsSection())
.build();

Section myWorkSection = Section.create()
.withTitle("Who pays me? (My Work)")
.andContent(new WorkSection())
.build();

Section homeSection = Section.create()
.withTitle("Where I reside? (My Home)")
.andContent(new HomeSection())
.build();

getStyle().set("margin","0 auto");
setMaxWidth("1000px");
addClassName("centered-content");
add(title, subTitle);

add(titleSection, aboutSection, socialSection, myProjectSection, myWorkSection, homeSection);

// hide the splash screen after the main view is loaded
UI.getCurrent().getPage().executeJs(
"document.querySelector('#splash-screen').classList.add('loaded')");
}

@Override
public void configurePage(InitialPageSettings settings) {
settings.addFavIcon("icon", "/icons/favicon-32x32.png", "32x32");
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/AboutSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;

public class AboutSection extends VerticalLayout {

public AboutSection() {
String sectionText = """
Software craftsman and DevOps engineer. \
Mainly dealing with Docker, Docker Swarm and Kubernetes.\
Developing in Java (Spring and Vaadin). \
Hobbies are: traveling, 4x4, aviation.
""";

add(sectionText);
}
}
13 changes: 13 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/HomeSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vdurmont.emoji.EmojiParser;
import io.kyberorg.whoami.Emoji;

public class HomeSection extends VerticalLayout {

public HomeSection() {
add(EmojiParser.parseToUnicode("I live in Pirita "+ Emoji.FOREST
+" district of Tallinn, capital of "+Emoji.ESTONIA));
}
}
22 changes: 22 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/ProjectsSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.orderedlayout.FlexLayout;
import io.kyberorg.whoami.elements.Logo;

public class ProjectsSection extends FlexLayout {

public ProjectsSection() {

Logo yalseeLogo = Logo.create()
.withSource("images/yalsee.png").withAltText("yals.ee")
.withUrl("https://yals.ee")
.build();

yalseeLogo.setWidth("4rem");
yalseeLogo.setHeight("4rem");

yalseeLogo.setTitle("Yalsee - the link shortener");

add(yalseeLogo);
}
}
42 changes: 42 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/Section.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H3;
import io.kyberorg.whoami.elements.Divider;

@Tag("section")
public class Section extends Div {

public static Builder create() {
return new Builder();
}

private Section(String title, Component content) {
H3 titleElement = new H3(title);
Divider divider = new Divider();

add(titleElement, divider, content);
}

public static class Builder {
private String title;
private Component content;

public Builder withTitle(String title) {
this.title = title;
return this;
}

public Builder andContent(Component content) {
this.content = content;
return this;
}

public Section build() {
return new Section(title, content);
}
}

}
31 changes: 31 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/SocialSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.orderedlayout.FlexLayout;
import io.kyberorg.whoami.elements.Logo;

public class SocialSection extends FlexLayout {

public SocialSection() {
Logo gitHubLogo = Logo.create()
.withSource("images/gh.png").withAltText("GitHub")
.withUrl("https://github.com/kyberorg")
.build();

Logo linkedInLogo = Logo.create()
.withSource("images/linked.png").withAltText("LinkedIn")
.withUrl("https://www.linkedin.com/in/kyberorg/")
.build();

Logo facebookLogo = Logo.create()
.withSource("images/fb.png").withAltText("Facebook")
.withUrl("https://www.facebook.com/kyberorg")
.build();

Logo twitterLogo = Logo.create()
.withSource("images/twitter.png").withAltText("Twitter")
.withUrl("https://twitter.com/kyberorg")
.build();

add(gitHubLogo, linkedInLogo, facebookLogo, twitterLogo);
}
}
34 changes: 34 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/TitleSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.Image;
import com.vaadin.flow.component.orderedlayout.FlexComponent;
import com.vaadin.flow.component.orderedlayout.FlexLayout;

public class TitleSection extends FlexLayout {

public static TitleSection getInstance() {
return new TitleSection();
}

private TitleSection() {
H2 title = new H2("Hello, I am kyberorg");
Image myPhoto = new Image("images/logo.png", "myPhoto");

title.getStyle().set("marginTop", "initial");
title.getStyle().set("marginRight", "2rem");
title.getStyle().set("marginBottom", "initial");
title.getStyle().set("marginLeft", "initial");

myPhoto.setWidth("4rem");
myPhoto.setWidth("4rem");
myPhoto.getStyle().set("borderRadius","100%");

setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
setAlignItems(FlexComponent.Alignment.CENTER);
setWidthFull();

add(title, myPhoto);
}

}
30 changes: 30 additions & 0 deletions src/main/java/io/kyberorg/whoami/ui/sections/WorkSection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.kyberorg.whoami.ui.sections;

import com.vaadin.flow.component.Text;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vdurmont.emoji.EmojiParser;
import io.kyberorg.whoami.Emoji;
import io.kyberorg.whoami.elements.Logo;

public class WorkSection extends VerticalLayout {

public WorkSection() {
FlexLayout firstLine = new FlexLayout();
Text first = new Text("I work at ");
Logo knLogo = Logo.create()
.withSource("images/kn.png").withAltText("Kühne+Nagel")
.build().roundLogo();

Text second = new Text(EmojiParser.parseToUnicode("and I "+ Emoji.LOVE +" it"));
firstLine.setAlignItems(Alignment.CENTER);
firstLine.add(first, knLogo, second);

FlexLayout secondLine = new FlexLayout();
Text availableForHireText = new Text("Am I available to hire: ");
Text availableForHireStatus = new Text(EmojiParser.parseToUnicode(Emoji.CROSS));

secondLine.add(availableForHireText, availableForHireStatus);
add(firstLine, secondLine);
}
}
Binary file added src/main/resources/META-INF/resources/images/fb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cd150c6

Please sign in to comment.