Skip to content

Commit

Permalink
feat: sandbox project
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykomiotek committed Feb 1, 2024
1 parent 6e3c2fd commit bd8cb48
Show file tree
Hide file tree
Showing 14 changed files with 32,063 additions and 16,142 deletions.
29 changes: 29 additions & 0 deletions apps/jobboard/src/app/(public)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { headers } from 'next/headers';
import { NavBar } from '../../components/NavBar';

type Props = {
children: React.ReactNode;
mobile: React.ReactNode;
desktop: React.ReactNode;
// admin: React.ReactNode;
};

export default function PublicLayout({ children, mobile, desktop }: Props) {
const headersList = headers();
const deviceHeader = headersList.get('x-device');

// fetch customer name, customerRecord ect.

return (
<>
<div className="mx-auto bg-slate-900 py-2">
<div className="container mx-auto text-white py-2">
<NavBar />
</div>
</div>
<div className="mx-auto py-2 mt-2">
<div className="container mx-auto py-4">{children}</div>
</div>
</>
);
}
13 changes: 13 additions & 0 deletions apps/jobboard/src/app/(public)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Header } from '@jobboard/common-ui';
import db from '@jobboard/prisma-client';

export default async function IndexPage() {
return (
<div id="welcome">
<Header>
<span> Hello there, </span>
Welcome jobboard 👋
</Header>
</div>
);
}
8 changes: 3 additions & 5 deletions apps/jobboard/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ export const metadata = {
description: 'Generated by create-nx-workspace',
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
type Props = { children: React.ReactNode };

export default function RootLayout({ children }: Props) {
return (
<html lang="en" className="h-full">
<body className={`${inter.className} h-full`}>{children}</body>
Expand Down
18 changes: 0 additions & 18 deletions apps/jobboard/src/app/page.tsx

This file was deleted.

22 changes: 22 additions & 0 deletions apps/jobboard/src/components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NavLink } from '../NavLink/NavLink';

export const NavBar = () => {
return (
<nav>
<ul className="flex">
<li className="mr-4">
<NavLink href="/">Home</NavLink>
</li>
<li className="mr-4">
<NavLink href="/job-offers">Job offers</NavLink>
</li>
<li className="mr-4">
<NavLink href="/about">About</NavLink>
</li>
<li className="mr-4">
<NavLink href="/contact">Contact</NavLink>
</li>
</ul>
</nav>
);
};
1 change: 1 addition & 0 deletions apps/jobboard/src/components/NavBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NavBar } from "./NavBar";
19 changes: 19 additions & 0 deletions apps/jobboard/src/components/NavLink/NavLink.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Meta, StoryObj } from "@storybook/react";

import { NavLink } from "./NavLink";

const meta = {
title: "UI/Atoms/NavLink",
component: NavLink,
tags: ["autodocs"],
} satisfies Meta<typeof NavLink>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
href: "#",
children: "Click me",
},
};
25 changes: 25 additions & 0 deletions apps/jobboard/src/components/NavLink/NavLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import Link, { type LinkProps } from 'next/link';
import { usePathname } from 'next/navigation';

import { classMerge } from '@jobboard/common-ui';

type Props = LinkProps & { children: string }; // LinkProps

export const NavLink = ({ href, children, ...props }: Props) => {
const currentPath = usePathname();
const isActive = currentPath.includes(href.toString());
return (
<Link
href={href}
className={classMerge('hover:text-blue-400', {
'text-red-500': isActive,
'text-blue-400': !isActive,
})}
{...props}
>
{children}
</Link>
);
};
1 change: 1 addition & 0 deletions apps/jobboard/src/components/NavLink/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NavLink } from "./NavLink";
4 changes: 3 additions & 1 deletion libs/prisma-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './lib/db';
import prisma from './lib/db';

export default prisma;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `employer` on the `JobOffer` table. All the data in the column will be lost.
- Added the required column `company` to the `JobOffer` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "JobOffer" DROP COLUMN "employer",
ADD COLUMN "company" TEXT NOT NULL;
2 changes: 1 addition & 1 deletion libs/prisma-schema/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ model JobOffer {
description String
position String
salary Float
employer String
company String
city String? @db.VarChar(100)
}
Loading

0 comments on commit bd8cb48

Please sign in to comment.