Skip to content

Commit

Permalink
Use sass to fix style bug
Browse files Browse the repository at this point in the history
@apply wasn't working for glass-tube in ::after
  • Loading branch information
imericxu committed Jul 10, 2024
1 parent 9a5abfb commit 7cb8c48
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 32 deletions.
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const nextConfig = {
*
* @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
*/
basePath: "/nextjs-github-pages",
basePath: "/mazejs",

/**
* Disable server-based image optimization. Next.js does not support
Expand Down
57 changes: 42 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
"eslint-plugin-react": "^7.34.3",
"globals": "^15.8.0",
"jsdom": "^24.1.0",
"postcss": "^8",
"postcss": "^8.4.39",
"prettier": "^3.3.2",
"prettier-plugin-css-order": "^2.1.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"sass": "^1.77.7",
"tailwindcss": "^3.4.1",
"tailwindcss-react-aria-components": "^1.1.3",
"typescript": "^5.4.5",
Expand Down
32 changes: 18 additions & 14 deletions src/app/globals.css → src/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@
}
}

@mixin glass-tube {
@apply shadow shadow-slate-400;
border: 1px solid hsl(215deg 25% 26.7% / 0.5);
border-radius: 9999px;
background-image: linear-gradient(
to bottom,
hsl(var(--color-slate-50) / 0.5),
hsl(var(--color-slate-900) / 0.2) 10%,
hsl(var(--color-slate-900) / 0.1) 30%,
hsl(var(--color-slate-50) / 0.05) 50%,
hsl(var(--color-slate-50) / 0.05) 80%,
hsl(var(--color-slate-50) / 0.4)
);
pointer-events: none;
}

@layer components {
/* Standalone glass tubes */
.glass-tube {
@apply shadow shadow-slate-400;
border: 1px solid hsl(215deg 25% 26.7% / 0.5);
border-radius: 9999px;
background-image: linear-gradient(
to bottom,
hsl(var(--color-slate-50) / 0.5),
hsl(var(--color-slate-900) / 0.2) 10%,
hsl(var(--color-slate-900) / 0.1) 30%,
hsl(var(--color-slate-50) / 0.05) 50%,
hsl(var(--color-slate-50) / 0.05) 80%,
hsl(var(--color-slate-50) / 0.4)
);
pointer-events: none;
@include glass-tube;
}

/* Glass-tube container (overlayed on top using pseudo-elements) */
Expand All @@ -47,7 +51,7 @@
border-radius: 9999px;

&::after {
@apply glass-tube;
@include glass-tube;
position: absolute;
inset: 0;
content: "";
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata } from "next";
import { Lato } from "next/font/google";
import { type ReactElement, type ReactNode } from "react";
import "./globals.css";
import "./globals.scss";
import { twMerge } from "tailwind-merge";

const latoFont = Lato({
Expand Down

0 comments on commit 7cb8c48

Please sign in to comment.