Skip to content

Homescreen and Infoscreen #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a2fc888
added rectImage (WIP)
LinkKF Feb 1, 2021
2fa8b00
refactored image components to one component
LinkKF Feb 9, 2021
67b7944
LinkKF Feb 9, 2021
e498bfd
refactored image components to one component
LinkKF Feb 9, 2021
8b94b83
added image size
LinkKF Feb 9, 2021
de2f117
adding picture on left/right side
LinkKF Feb 11, 2021
9edd6e0
renamed "shape" to "props"
LinkKF Feb 11, 2021
c31d4c1
added component homescreen
LinkKF Feb 11, 2021
233d44c
inserting adapting text (no real design yet)
LinkKF Feb 12, 2021
1ec31da
Removed Hello World Text (for testing purposes)
LinkKF Feb 12, 2021
08d222b
removed content (for testing purposes)
LinkKF Feb 12, 2021
bc1f9bf
renamed container
LinkKF Feb 12, 2021
16c35de
added float left/right
LinkKF Feb 12, 2021
47ac3fa
added info component (not yet finished)
LinkKF Feb 12, 2021
f6d789b
added textField
LinkKF Feb 12, 2021
d5022ac
fixed homescreen
LinkKF Feb 12, 2021
cde5404
changed from float to flexboxes
LinkKF Feb 22, 2021
aaddfb6
Homescreen adaptations
LinkKF Feb 23, 2021
b12fbd2
added second content page with "Code" for content
LinkKF Feb 23, 2021
60729a2
made text variable
LinkKF Feb 23, 2021
ef119ff
added border radius
LinkKF Feb 26, 2021
13705c5
added responsive design
LinkKF Feb 26, 2021
7f55237
filter:none
LinkKF Feb 26, 2021
5c92cf4
added white background to welcome text
LinkKF Mar 22, 2021
add9c8d
added additiona Information div for things
LinkKF Mar 22, 2021
232fcb0
removed additional Info div, when empty
LinkKF Mar 22, 2021
d0b4047
Merge branch 'development' into new-components
LinkKF Mar 24, 2021
006343f
add contentPage for development purpose
LinkKF Mar 24, 2021
8bf3641
""
LinkKF Mar 26, 2021
da38877
added module stuff
LinkKF Mar 27, 2021
10722d9
made homescreen background variable
LinkKF Mar 27, 2021
74315cd
undid changes in helloWorld
LinkKF Mar 27, 2021
edab7cc
deleted classes roundImage and textField
LinkKF Mar 29, 2021
39cd744
merge branch development into new-components
LinkKF Mar 29, 2021
10f92a7
reformatted Info method
LinkKF Mar 29, 2021
80a21e5
removed round-image
LinkKF Mar 29, 2021
3552986
Merge branch 'development' into new-components
LinkKF Mar 29, 2021
0bf04fc
adressed PR changes
LinkKF Mar 29, 2021
b7f5bfe
remove position relative
LinkKF Mar 29, 2021
655c9e0
added max-size for full image size
LinkKF Mar 30, 2021
946514b
resize navbar to fit to page
LinkKF Mar 30, 2021
41c18f6
undid changes on navbar
LinkKF Mar 30, 2021
6630bb0
reformatted package/removed redundant package-lock
LinkKF Mar 30, 2021
f186974
reformatted files
LinkKF Mar 30, 2021
9325b77
reformatted file
LinkKF Mar 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions frontend/src/components/mdx/homescreen/homescreen.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@use '../../style/globals';

.homeContainer {
display: grid;
place-items: center;
position: absolute;
bottom: 0;
color: black;
content: "";
z-index: -5;
width: 100%;
height: 100%;
background-size: cover;
background-position: center 0%;
}

.homeContainer-inside {
background-color: white;
color: black;
font-size: 40pt;
text-align: center;
z-index: 1;
}
10 changes: 10 additions & 0 deletions frontend/src/components/mdx/homescreen/homescreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import homescreenStyles from './homescreen.module.scss';
import React from "react";

export function Homescreen({ src, text }: { src: string, props: string, alt: string, text: string }): React.ReactElement {
return <div className={`${homescreenStyles["homeContainer"]}`} style={{backgroundImage: `url(${src})`}} >
<div className={`${homescreenStyles["homeContainer-inside"]}`}>
{text}
</div>
</div>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@
&-large {
@include square-image(15rem);
}

&-full {
@include square-image(clamp(0px, 100%, 1080px));
}
}

.round {
border-radius: 50%;
}

.rectangle {
border-radius: 5%;
}
13 changes: 13 additions & 0 deletions frontend/src/components/mdx/image/image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import imageStyles from './image.module.scss';

import React from "react";

export type ImageSize = "small" | "medium" | "large" | "full";
export type ImageShape = "round" | "rectangle";

export function Image({ src, alt, size, shape }: { src: string, alt: string, size?: ImageSize, shape?: ImageShape}): React.ReactElement {
const sizeStyleName: keyof typeof imageStyles = `square-${size ?? "medium"}` as const;
const shapeStyleName: keyof typeof imageStyles = shape ?? "rectangle" as const;

return <img src={src} className={`${imageStyles[shapeStyleName]} ${imageStyles[sizeStyleName]}`} alt={alt} />;
}
50 changes: 50 additions & 0 deletions frontend/src/components/mdx/info/info.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@use '../../style/globals';

.infoContainer {
display: flex;
position: relative;
text-align: center;
width: 100%;
color: rgb(0, 0, 0);
font-size: 20pt;
flex-direction: column;
margin-bottom: 25px;
}

.text {
width: 100%;
}

.image {
width: 100%;
}

.additionalInfo {
display: none;
}

@media (min-width: 450px) {
.infoContainer-left {
flex-direction: row;
}

.infoContainer-right {
flex-direction: row-reverse;
}

.text {
width: 65%;
}

.image {
width: 25%;
}
.additionalInfo {
width: 15%;
font-size: 10pt;
display: flex;
&:empty {
display: none;
}
}
}
22 changes: 22 additions & 0 deletions frontend/src/components/mdx/info/info.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import infoStyles from './info.module.scss';
import { Image } from 'components/mdx/image/image';

import React from "react";

export type ImagePosition = "left" | "right";

export function Info({ src, text, addInfo, imagePosition, alt }
:{ src: string, text: string, addInfo: string, propsImage: string, imagePosition?: ImagePosition, alt: string })
: React.ReactElement {
const position: keyof typeof infoStyles = `infoContainer-${imagePosition ?? "left"}` as const;

return <div className={`${infoStyles[position]} ${infoStyles["infoContainer"]}`}>
<div className={`${infoStyles["additionalInfo"]}`}>{addInfo}</div>
<div className={`${infoStyles["image"]}`}>
<Image src={src} size="full" shape="rectangle" alt={alt} />
</div>
<div className={`${infoStyles["text"]}`}>
{text}
</div>
</div>;
}
11 changes: 0 additions & 11 deletions frontend/src/components/mdx/round-image/roundImage.tsx

This file was deleted.

16 changes: 16 additions & 0 deletions frontend/src/content/contentPage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Info } from '../components/mdx/info/info';
import {Homescreen} from '../components/mdx/homescreen/homescreen';

<Homescreen src={"https://upload.wikimedia.org/wikipedia/commons/9/99/Karlsruhe-Schloss-meph666-2005-Apr-22.jpg"}
propsImage={"image-rectangle image-full"} text={"Willkommen in Karlsruhe"} alt={"A lorem picsum"}/>


<Info src={"https://upload.wikimedia.org/wikipedia/commons/9/99/Karlsruhe-Schloss-meph666-2005-Apr-22.jpg"}
imagePosition={"left"} alt={"A lorem picsum"} text={"Bilder können sowohl links vom Text,"}
addInfo={"Hier stehen Öfnnungszeiten, Adresse, o.ä."}/>
<Info src={"https://upload.wikimedia.org/wikipedia/commons/9/99/Karlsruhe-Schloss-meph666-2005-Apr-22.jpg"}
imagePosition={"right"} alt={"A lorem picsum"}
text={"als auch rechts vom Text sein. Problem ist jetzt nur noch, dass Bilder in Zeilen ohne addInfo ein wenig größer sind."}
addInfo={"Zum nächsten Bild gibts keine zusätzlichen Infos, deshalb wird dort nichts angezeigt!"}/>
<Info src={"https://upload.wikimedia.org/wikipedia/commons/9/99/Karlsruhe-Schloss-meph666-2005-Apr-22.jpg"}
imagePosition={"left"} alt={"A lorem picsum"} text={"Das ist das Karlsruher Schloss. Gebaut wurde es damals und seitdem steht es da."}/>
8 changes: 2 additions & 6 deletions frontend/src/content/helloWorld.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { RoundImage } from '../components/mdx/round-image/roundImage';

# Hello world from mdx!

## Regular markdown (GitHub flavor)
import { Image } from '../components/mdx/image/image';

You can write anything here that is allowed in regulra markdown files as well.
This includes _italic_, **bold** and ~~struck-through~~ text, [links with a descriptor](https://github.github.com/gfm/) and even tables:
Expand Down Expand Up @@ -32,7 +28,7 @@ As a surprise, mdx also supports task list items:
The following image is a regular React component.
By writing powerful, highly-adjustable components, we can write beautiful-looking articles with almost no effort in a maintainable way.

<RoundImage src={"https://picsum.photos/100/200"} alt={"A lorem picsum"} size={"medium"}/>
<Image src={"https://picsum.photos/100/200"} alt={"A lorem picsum"} size={"medium"}/>

## A note on styling

Expand Down