Started with a simple homepage

This commit is contained in:
Martin Berg Alstad
2022-12-21 13:56:42 +01:00
parent 5e8aefe665
commit 6798840a6b
18 changed files with 297 additions and 149 deletions

23
src/components/card.tsx Normal file
View File

@ -0,0 +1,23 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { CardProps } from "../types/interfaces";
import { H3 } from "./text";
import { A } from "./link";
const Card: Component<CardProps> = ({ children, className, title, to, newTab = false }) => {
return (
<>
<A className={"text-white"} to={ to } newTab={ newTab }>
<div
class={ `relative bg-gradient-to-r from-cyan-600 to-cyan-500 min-w-64 rounded-2xl ${ className }` }>
<div class="relative p-5">
<H3 className={ "text-center" }>{ title }</H3>
{ children }
</div>
</div>
</A>
</>
);
};
export default Card;

18
src/components/header.tsx Normal file
View File

@ -0,0 +1,18 @@
/* @refresh reload */
import { Component } from "solid-js";
import { SimpleProps, TitleProps } from "../types/interfaces";
import { H1 } from "./text";
const Header: Component<TitleProps> = ({ className, title }) => {
return (
<header class={ className }>
<H1 className={ "text-center" }>{ title }</H1>
<div class={"mx-auto w-fit"}>
<p>Av Martin Berg Alstad</p>
</div>
</header>
);
};
export default Header;

View File

@ -0,0 +1,17 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { TitleProps } from "../types/interfaces";
import Header from "./header";
export const Layout: Component<TitleProps> = ({ children, title, className }) => {
return (
<div class={ `bg-default-bg text-white min-h-screen font-mono ${ className }` }>
<div class="container mx-auto debug">
<Header className={"my-3"} title={ title } />
<main>
{ children }
</main>
</div>
</div>
);
};

View File

@ -1,5 +1,6 @@
import { Component, JSX } from "solid-js";
import { LinkProps } from "../types/interfaces";
/* @refresh reload */
import { type Component } from "solid-js";
import type { LinkProps } from "../types/interfaces";
export const A: Component<LinkProps> = (
{
@ -9,7 +10,7 @@ export const A: Component<LinkProps> = (
className,
id,
newTab = true,
}): JSX.Element => {
}) => {
return (
<a href={ to } id={ id }
rel={ `${ rel } ${ newTab ? "noreferrer" : undefined }` }

18
src/components/text.tsx Normal file
View File

@ -0,0 +1,18 @@
import { type Component } from "solid-js";
import type { ChildProps } from "../types/interfaces";
export const H1: Component<ChildProps> = ({ children, className }) => {
return (
<>
<h1 class={ `text-4xl ${ className }` }>{ children }</h1>
</>
);
};
export const H3: Component<ChildProps> = ({ children, className }) => {
return (
<>
<h3 class={ `text-2xl ${ className }` }>{ children }</h3>
</>
);
};