Skip to content
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

Add Prisma partner theme #151

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions app/(navigation)/(code)/assets/prisma.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions app/(navigation)/(code)/components/Frame.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,82 @@
}
}

/* Prisma Frame */

.prismaFrame {
--gradient-angle: 140deg;
background: linear-gradient(var(--gradient-angle), #0c1d26 0%, #0a0c17 100%);
}

.prismaWindow {
position: relative;
overflow: visible;
border: 1px solid transparent;
border-radius: var(--radius);
background-color: var(--background);
--radius: 10px;
--frame-border-gradient: linear-gradient(var(--gradient-angle), #3e4083, #16544f);
--background: hsla(223, 41%, 7%, 75%);

[data-frameborder] {
&:before {
position: absolute;
border: 1px solid transparent;
border-radius: var(--radius);
background: var(--frame-border-gradient) border-box;
content: "";
inset: 0;
mask:
linear-gradient(#fff 0 0) padding-box,
linear-gradient(#fff 0 0);
mask-composite: exclude;
pointer-events: none;
}
&:nth-of-type(1):before {
inset: -1px;
}
&:nth-of-type(2):before {
border-radius: calc(var(--radius) + 6px);
inset: -6px;
opacity: 50%;
}

&:nth-of-type(3):before {
border-radius: calc(var(--radius) + 11px);
inset: -11px;
opacity: 30%;
}

&:nth-of-type(4):before {
border-radius: calc(var(--radius) + 16px);
inset: -16px;
opacity: 10%;
}
}
}

.prismaHeader {
display: flex;
height: 40px;
align-items: center;
padding: 0 20px;
}

.prismaFrameLightMode {
background: linear-gradient(140deg, #e8e8ff 0%, #e7fefc 100%);

&.noBackground {
.prismaWindow {
--background: hsl(193, 72%, 96%, 0.9);
}
}

.prismaWindow {
--background: hsl(193, 72%, 96%, 0.5);
--frame-border-gradient: linear-gradient(var(--gradient-angle), #6164cc, #31baaf);
}
}

.bitmap {
--frame-background: rgba(255, 255, 255, 0.95);

Expand Down
72 changes: 47 additions & 25 deletions app/(navigation)/(code)/components/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ import ResizableFrame from "./ResizableFrame";

import styles from "./Frame.module.css";
import { selectedLanguageAtom } from "../store/code";
import Image from "next/image";

import beams from "../assets/tailwind/beams.png";
import beamsLight from "../assets/tailwind/beams-light.jpg";
import beamsDark from "../assets/tailwind/beams-dark.jpg";

import clerkPattern from "../assets/clerk/pattern.svg?url";

Expand Down Expand Up @@ -161,6 +158,33 @@ const ClerkFrame = () => {
);
};

const PrismaFrame = () => {
const [darkMode] = useAtom(darkModeAtom);
const [padding] = useAtom(paddingAtom);
const [showBackground] = useAtom(showBackgroundAtom);

return (
<div
className={classNames(
styles.frame,
styles.prismaFrame,
!darkMode && styles.prismaFrameLightMode,
!showBackground && styles.noBackground,
)}
style={{ padding }}
>
{!showBackground && <div data-ignore-in-export className={styles.transparentPattern}></div>}
<div className={styles.prismaWindow}>
<span data-frameborder />
<span data-frameborder />
<span data-frameborder />
<span data-frameborder />
<Editor />
</div>
</div>
);
};

const DefaultFrame = () => {
const [padding] = useAtom(paddingAtom);
const isSafari = useIsSafari();
Expand Down Expand Up @@ -215,21 +239,29 @@ const Frame = ({ resize = true }: { resize?: boolean }) => {
const [theme] = useAtom(themeAtom);
const darkMode = useAtomValue(darkModeAtom);

function renderFrame() {
switch (theme.id) {
case THEMES.vercel.id:
case THEMES.rabbit.id:
return <VercelFrame />;
case THEMES.supabase.id:
return <SupabaseFrame />;
case THEMES.tailwind.id:
return <TailwindFrame />;
case THEMES.clerk.id:
return <ClerkFrame />;
case THEMES.prisma.id:
return <PrismaFrame />;
default:
return <DefaultFrame />;
}
}

if (!resize) {
return (
<div className={styles.frameContainer}>
<div className={styles.outerFrame} ref={frameContext} id="frame">
{[THEMES.vercel.id, THEMES.rabbit.id].includes(theme.id) ? (
<VercelFrame />
) : THEMES.supabase.id === theme.id ? (
<SupabaseFrame />
) : THEMES.tailwind.id === theme.id ? (
<TailwindFrame />
) : THEMES.clerk.id === theme.id ? (
<ClerkFrame />
) : (
<DefaultFrame />
)}
{renderFrame()}
</div>
</div>
);
Expand All @@ -240,17 +272,7 @@ const Frame = ({ resize = true }: { resize?: boolean }) => {
<ResizableFrame>
<FlashMessage />
<div className={styles.outerFrame} ref={frameContext} id="frame">
{[THEMES.vercel.id, THEMES.rabbit.id].includes(theme.id) ? (
<VercelFrame />
) : THEMES.supabase.id === theme.id ? (
<SupabaseFrame />
) : THEMES.tailwind.id === theme.id ? (
<TailwindFrame />
) : THEMES.clerk.id === theme.id ? (
<ClerkFrame />
) : (
<DefaultFrame />
)}
{renderFrame()}
</div>
</ResizableFrame>
</div>
Expand Down
50 changes: 50 additions & 0 deletions app/(navigation)/(code)/store/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import TailwindLogo from "../assets/tailwind.svg";
import TailwindLogoUrl from "../assets/tailwind.svg?url";
import ClerkLogo from "../assets/clerk.svg";
import ClerkLogoUrl from "../assets/clerk.svg?url";
import PrismaLogo from "../assets/prisma.svg";
import PrismaLogoUrl from "../assets/prisma.svg?url";
import { showLineNumbersAtom } from ".";
import { createCssVariablesTheme } from "../util/theme-css-variables";
import { BASE_URL } from "@/utils/common";
Expand Down Expand Up @@ -303,6 +305,54 @@ export const THEMES: { [index: string]: Theme } = {
}),
},
},
prisma: {
id: "prisma",
name: "Prisma",
background: {
from: "#000",
to: "#000",
},
icon: PrismaLogo,
iconUrl: `${BASE_URL}${PrismaLogoUrl.src}`,
partner: true,
lineNumbers: true,
syntax: {
light: convertToShikiTheme({
foreground: "#1A202C",
constant: "#5A67D8",
string: "#16A394",
comment: "#718096",
keyword: "#16A394",
parameter: "#805AD5",
function: "#5A67D8",
stringExpression: "#16A394",
punctuation: "#1A202C",
link: "#5A67D8",
number: "#16A394",
property: "#16A394",
highlight: "#16a39528",
highlightHover: "#16a3950e",
highlightBorder: "#16A394",
}),
dark: convertToShikiTheme({
foreground: "#ffffff",
constant: "#7F9CF5",
string: "#71E8DF",
comment: "#718096",
keyword: "#71E8DF",
parameter: "#71E8DF",
function: "#7F9CF5",
stringExpression: "#71E8DF",
punctuation: "#FFFFFF",
link: "#7F9CF5",
number: "#71E8DF",
property: "#71E8DF",
highlight: "#71e8de2e",
highlightHover: "#71e8de1b",
highlightBorder: "#71E8DF",
}),
},
},
bitmap: {
id: "bitmap",
name: "Bitmap",
Expand Down