Skip to content

Commit

Permalink
Logo
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone committed Aug 15, 2024
1 parent 7277bcc commit ae7d239
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 8 deletions.
12 changes: 6 additions & 6 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ const config: Config = {
// image: "img/docusaurus-social-card.jpg",
navbar: {
title: "Grats",
/*
logo: {
alt: "Grats Logo",
src: "img/logo.svg",
},
*/
logo: {
alt: "Grats",
src: "img/logo.svg",
target: "_self",
style: {},
},
items: [
{
type: "docSidebar",
Expand Down
10 changes: 10 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
--ifm-color-primary-lightest: #5fa6e1;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
--text-shadow-glow: 0 0 8px rgba(0, 0, 0, 0.3), 0 0 4px rgba(0, 0, 0, 0.2);
}

/* For readability concerns, you should choose a lighter palette in dark mode. */
Expand All @@ -27,6 +28,8 @@
--ifm-color-primary-lighter: #f051b4;
--ifm-color-primary-lightest: #f36fbd;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
--text-shadow-glow: 0 0 5px rgba(255, 255, 255, 0.15),
0 0 3px rgba(255, 255, 255, 0.1);
}

.cm-editor {
Expand All @@ -41,3 +44,10 @@
.code-trimmed-line {
display: none;
}

iframe[src*="youtube"] {
display: block;
margin: 0 auto;
max-width: 100%;
padding-bottom: 10px;
}
4 changes: 4 additions & 0 deletions website/src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
background: linear-gradient(165deg, #3178c6, #e10098);
}

.titleShadow {
text-shadow: var(--text-shadow-glow);
}

@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
Expand Down
9 changes: 7 additions & 2 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ import Layout from "@theme/Layout";
import HomepageFeatures from "@site/src/components/HomepageFeatures";

import styles from "./index.module.css";
import { GratsLogo } from "./logo";

Check failure on line 10 in website/src/pages/index.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

'GratsLogo' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 10 in website/src/pages/index.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

'GratsLogo' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 10 in website/src/pages/index.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

'GratsLogo' is defined but never used. Allowed unused vars must match /^_/u

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
return (
<header className={clsx("hero hero--primary", styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<h1 className={clsx("hero__title", styles.titleShadow)}>
{siteConfig.title}
</h1>
<p className={clsx("hero__subtitle", styles.titleShadow)}>
{siteConfig.tagline}
</p>
<div style={{ display: "flex", justifyContent: "center", gap: "2em" }}>
<div className={styles.buttons}>
<Link
Expand Down
196 changes: 196 additions & 0 deletions website/src/pages/logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
import { Line } from "@codemirror/state";

Check failure on line 1 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

'Line' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 1 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

'Line' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 1 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

'Line' is defined but never used. Allowed unused vars must match /^_/u
import { off } from "process";

Check failure on line 2 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

'off' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 2 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

'off' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 2 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

'off' is defined but never used. Allowed unused vars must match /^_/u

const TS_BLUE = "#3178C6";
const TS_MID = "#235A97";

Check failure on line 5 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

'TS_MID' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 5 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

'TS_MID' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 5 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

'TS_MID' is assigned a value but never used. Allowed unused vars must match /^_/u
const TS_LIGHT = "#358EF1";
const TS_DARK = "#00273F";

Check failure on line 7 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

'TS_DARK' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 7 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

'TS_DARK' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 7 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

'TS_DARK' is assigned a value but never used. Allowed unused vars must match /^_/u
const GRAPHQL_RHODAMINE = "#E10098";
const GRAPHQL_MID = "rgb(196 56 150)";

const OFFSET = 20;

function calculateHexagonPoints(): { x: number; y: number }[] {
const width = 100;
const height = 100;

const centerX = width / 2;
const centerY = height / 2;

const radius = height / 2;

const points: { x: number; y: number }[] = [];

// Calculate the angle offset (30 degrees in radians)
const angleOffset = Math.PI / 6;

// Calculate the points of the hexagon
for (let i = 0; i < 6; i++) {
const angle = (i * Math.PI) / 3 + angleOffset;
const x = centerX + radius * Math.cos(angle);
const y = centerY + radius * Math.sin(angle);
points.push({ x, y });
}

return points;
}

function offset(pos) {
return { x: pos.x + OFFSET, y: pos.y + OFFSET };
}

export function GratsLogo({ opacity = 1 }) {
// Compute points of the hexagon with points
// at the middle top and bottom
const points = calculateHexagonPoints().map(offset);
const lowerRight = points[0];
const bottom = points[1];
const lowerLeft = points[2];
const upperLeft = points[3];
const top = points[4];
const upperRight = points[5];
const center = offset({ x: 50, y: 50 });

const tsLinesColor = GRAPHQL_MID;
const gqlColor = GRAPHQL_RHODAMINE;

const gqlWidth = 8;
const tsWidth = 12;

const showGradient = true;
const gradient180 = "grad180";
const gradient0 = "grad0";
const gradient45 = "grad45";
return (
<svg
width={100 + OFFSET * 2}
height={100 + OFFSET * 2}
xmlns="http://www.w3.org/2000/svg"
>
<defs>
<LinearGradient
angle={120}
startColor={TS_LIGHT}
endColor={TS_LIGHT}
id={gradient45}
/>
<LinearGradient
angle={45}
startColor={TS_BLUE}
endColor={TS_BLUE}
id={gradient180}
/>
<LinearGradient
angle={180}
startColor={TS_LIGHT}
endColor={TS_LIGHT}
id={gradient0}
/>
</defs>
{showGradient && (
<>
<Polygon
opacity={opacity}
fill={`url(#${gradient180})`}
points={[upperLeft, center, bottom, lowerLeft]}
/>
<Polygon
opacity={opacity}
fill={`url(#${gradient45})`}
points={[upperLeft, top, upperRight, center]}
/>
<Polygon
opacity={opacity}
fill={`url(#${gradient0})`}
points={[upperRight, lowerRight, bottom, center]}
/>
</>
)}

{false && (

Check failure on line 110 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Unexpected constant truthiness on the left-hand side of a `&&` expression

Check failure on line 110 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (20.x)

Unexpected constant truthiness on the left-hand side of a `&&` expression

Check failure on line 110 in website/src/pages/logo.tsx

View workflow job for this annotation

GitHub Actions / Lint (21.x)

Unexpected constant truthiness on the left-hand side of a `&&` expression
<>
<Polyline
points={[upperRight, top]}
stroke={gqlColor}
strokeWidth={gqlWidth}
fill="none"
/>
<Polyline
points={[center, upperLeft]}
stroke={gqlColor}
strokeWidth={gqlWidth}
fill="none"
/>
<Polyline
points={[center, bottom]}
stroke={gqlColor}
strokeWidth={gqlWidth}
fill="none"
/>
</>
)}
<>
{/* Draw the TS color */}
<Dot center={center} r={tsWidth} fill={tsLinesColor} />
<Dot center={top} r={tsWidth} fill={tsLinesColor} />
<Polyline
points={[
center,
upperRight,
lowerRight,
bottom,
lowerLeft,
upperLeft,
top,
]}
stroke={tsLinesColor}
strokeWidth={tsWidth}
fill="none"
/>
</>
</svg>
);
}

function Dot({ center, ...rest }) {
return <circle cx={center.x} cy={center.y} {...rest} />;
}

function Polyline({ points, ...rest }) {
return (
<polyline
points={points.map((pos) => `${pos.x}, ${pos.y}`).join(" ")}
{...rest}
/>
);
}

function Polygon({ points, ...rest }) {
return (
<polygon
points={points.map((pos) => `${pos.x}, ${pos.y}`).join(" ")}
{...rest}
/>
);
}

const calculateGradientDirection = (angle) => {
const rad = (angle * Math.PI) / 180;
const x1 = 50 + Math.cos(rad) * 50;
const y1 = 50 - Math.sin(rad) * 50;
const x2 = 50 - Math.cos(rad) * 50;
const y2 = 50 + Math.sin(rad) * 50;

return { x1: `${x1}%`, y1: `${y1}%`, x2: `${x2}%`, y2: `${y2}%` };
};

function LinearGradient({ angle, startColor, endColor, id }) {
const { x1, y1, x2, y2 } = calculateGradientDirection(angle);

return (
<linearGradient id={id} x1={x1} y1={y1} x2={x2} y2={y2}>
<stop offset="0%" style={{ stopColor: startColor, stopOpacity: 1 }} />
<stop offset="100%" style={{ stopColor: endColor, stopOpacity: 1 }} />
</linearGradient>
);
}
Binary file modified website/static/img/favicon.ico
Binary file not shown.
22 changes: 22 additions & 0 deletions website/static/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ae7d239

Please sign in to comment.