Update
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "next/core-web-vitals"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
name: Docker
|
||||||
|
|
||||||
|
# Gitea Actions workflow: builds the Docker image and publishes it to the
|
||||||
|
# Gitea Container Registry hosted on this Gitea instance.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Derive the registry host from the Gitea instance URL (e.g.
|
||||||
|
# https://gitea.example.com -> gitea.example.com). The Gitea Container
|
||||||
|
# Registry is served from the instance root, so this works on any host.
|
||||||
|
- name: Resolve registry host
|
||||||
|
run: echo "REGISTRY=${GITHUB_SERVER_URL#*://}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Set up BuildKit Docker container builder to be able to build
|
||||||
|
# multi-platform images and export cache.
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# Log into the Gitea Container Registry except on PR.
|
||||||
|
#
|
||||||
|
# NOTE: Gitea's automatic Actions token (secrets.GITHUB_TOKEN) is NOT
|
||||||
|
# granted package scope, so it cannot push to the container registry.
|
||||||
|
# Create a Gitea personal access token with the "write:package" scope
|
||||||
|
# (Settings -> Applications -> Access Tokens) and add it as a repo/org
|
||||||
|
# Actions secret named PACKAGES_TOKEN. Set PACKAGES_USER to the token
|
||||||
|
# owner's username (defaults to the triggering actor).
|
||||||
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ vars.PACKAGES_USER || github.actor }}
|
||||||
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||||
|
|
||||||
|
# Extract metadata (tags, labels) for Docker.
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ github.repository }}
|
||||||
|
|
||||||
|
# Build and push the Docker image with Buildx (don't push on PR).
|
||||||
|
- name: Build and push Docker image
|
||||||
|
id: build-and-push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
# NOTE: type=gha cache is intentionally omitted. Gitea's act_runner cache
|
||||||
|
# service is not reachable from the buildx container on this instance, so
|
||||||
|
# cache import timed out (~30s) on every run. The Dockerfile's BuildKit
|
||||||
|
# cache mounts still speed up dependency installs within a build.
|
||||||
|
platforms: linux/amd64
|
||||||
|
|
||||||
|
# Tell Arcane to pull the freshly-pushed image and recreate the container.
|
||||||
|
#
|
||||||
|
# Create the webhook in Arcane: Settings -> Webhooks -> New, targeting the
|
||||||
|
# compose PROJECT with the "update" action (pulls new images + recreates
|
||||||
|
# changed services). Arcane shows the token (arc_wh_...) exactly once; the
|
||||||
|
# full trigger URL is
|
||||||
|
# https://<arcane-host>/api/webhooks/trigger/arc_wh_xxxxxxxx...
|
||||||
|
# Store that whole URL as the Actions secret ARCANE_WEBHOOK_URL. The
|
||||||
|
# endpoint is unauthenticated apart from the token in the path (rate-limited
|
||||||
|
# to 60 req / 10s per IP), takes no body, and only fires on real pushes to
|
||||||
|
# main — not on PRs, and skipped automatically if the secret is unset.
|
||||||
|
- name: Trigger Arcane deployment
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
env:
|
||||||
|
ARCANE_WEBHOOK_URL: ${{ secrets.ARCANE_WEBHOOK_URL }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$ARCANE_WEBHOOK_URL" ]; then
|
||||||
|
echo "ARCANE_WEBHOOK_URL not set; skipping deploy trigger."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
code=$(curl -sS -o /dev/null -w '%{http_code}' -X POST "$ARCANE_WEBHOOK_URL")
|
||||||
|
echo "Arcane webhook responded with HTTP $code"
|
||||||
|
case "$code" in
|
||||||
|
2*) echo "Deployment triggered." ;;
|
||||||
|
*) echo "::error::Arcane webhook failed (HTTP $code)"; exit 1 ;;
|
||||||
|
esac
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
name: Docker
|
|
||||||
|
|
||||||
# This workflow uses actions that are not certified by GitHub.
|
|
||||||
# They are provided by a third-party and are governed by
|
|
||||||
# separate terms of service, privacy policy, and support
|
|
||||||
# documentation.
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '38 21 * * *'
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
# Publish semver tags as releases.
|
|
||||||
tags: [ 'v*.*.*' ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
# Use docker.io for Docker Hub if empty
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
# github.repository as <account>/<repo>
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
# This is used to complete the identity challenge
|
|
||||||
# with sigstore/fulcio when running outside of PRs.
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# Install the cosign tool except on PR
|
|
||||||
# https://github.com/sigstore/cosign-installer
|
|
||||||
- name: Install cosign
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
|
||||||
with:
|
|
||||||
cosign-release: 'v2.2.4'
|
|
||||||
|
|
||||||
# Set up BuildKit Docker container builder to be able to build
|
|
||||||
# multi-platform images and export cache
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
|
||||||
|
|
||||||
# Login against a Docker registry except on PR
|
|
||||||
# https://github.com/docker/login-action
|
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# Extract metadata (tags, labels) for Docker
|
|
||||||
# https://github.com/docker/metadata-action
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
|
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
|
||||||
# https://github.com/docker/build-push-action
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build-and-push
|
|
||||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
# Sign the resulting Docker image digest except on PRs.
|
|
||||||
# This will only write to the public Rekor transparency log when the Docker
|
|
||||||
# repository is public to avoid leaking data. If you would like to publish
|
|
||||||
# transparency data even for private images, pass --force to cosign below.
|
|
||||||
# https://github.com/sigstore/cosign
|
|
||||||
- name: Sign the published Docker image
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
env:
|
|
||||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
|
||||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
|
||||||
# This step uses the identity token to provision an ephemeral certificate
|
|
||||||
# against the sigstore community Fulcio instance.
|
|
||||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|
|
||||||
+85
-34
@@ -1,66 +1,117 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# ============================================
|
||||||
|
# Stage 1: Dependencies Installation Stage
|
||||||
|
# ============================================
|
||||||
|
|
||||||
FROM node:18-alpine AS base
|
# IMPORTANT: Node.js Version Maintenance
|
||||||
|
# This Dockerfile uses Node.js 24.18.0-slim, which was the latest LTS version at the time of writing.
|
||||||
|
# To ensure security and compatibility, regularly update the NODE_VERSION ARG to the latest LTS version.
|
||||||
|
ARG NODE_VERSION=24.18.0-slim
|
||||||
|
|
||||||
# Install dependencies only when needed
|
FROM node:${NODE_VERSION} AS dependencies
|
||||||
FROM base AS deps
|
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Set working directory
|
||||||
RUN apk add --no-cache libc6-compat
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Copy package-related files first to leverage Docker's caching mechanism
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
||||||
RUN \
|
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
# Install project dependencies with frozen lockfile for reproducible builds
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
RUN --mount=type=cache,target=/root/.npm \
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
--mount=type=cache,target=/usr/local/share/.cache/yarn \
|
||||||
else echo "Lockfile not found." && exit 1; \
|
--mount=type=cache,target=/root/.local/share/pnpm/store \
|
||||||
|
if [ -f package-lock.json ]; then \
|
||||||
|
npm ci --no-audit --no-fund; \
|
||||||
|
elif [ -f yarn.lock ]; then \
|
||||||
|
corepack enable yarn && yarn install --frozen-lockfile --production=false; \
|
||||||
|
elif [ -f pnpm-lock.yaml ]; then \
|
||||||
|
# --config.strictDepBuilds=false: pnpm 11 hard-fails (ERR_PNPM_IGNORED_BUILDS)
|
||||||
|
# when a dependency with a build script (e.g. sharp) isn't explicitly approved.
|
||||||
|
# sharp ships prebuilt binaries so its build script is unnecessary; this flag
|
||||||
|
# downgrades the gate to a warning and keeps the build resilient regardless of
|
||||||
|
# pnpm-workspace.yaml's allowBuilds value. See CLAUDE.md "pnpm / sharp build".
|
||||||
|
corepack enable pnpm && pnpm install --frozen-lockfile --config.strictDepBuilds=false; \
|
||||||
|
else \
|
||||||
|
echo "No lockfile found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Stage 2: Build Next.js application in standalone mode
|
||||||
|
# ============================================
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
FROM node:${NODE_VERSION} AS builder
|
||||||
FROM base AS builder
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
|
# Copy project dependencies from dependencies stage
|
||||||
|
COPY --from=dependencies /app/node_modules ./node_modules
|
||||||
|
|
||||||
|
# Copy application source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# Next.js collects completely anonymous telemetry data about general usage.
|
# Next.js collects completely anonymous telemetry data about general usage.
|
||||||
# Learn more here: https://nextjs.org/telemetry
|
# Learn more here: https://nextjs.org/telemetry
|
||||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||||
# ENV NEXT_TELEMETRY_DISABLED=1
|
# ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN \
|
# Build Next.js application
|
||||||
if [ -f yarn.lock ]; then yarn run build; \
|
# If you want to speed up Docker rebuilds, you can cache the build artifacts
|
||||||
elif [ -f package-lock.json ]; then npm run build; \
|
# by adding: --mount=type=cache,target=/app/.next/cache
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
# This caches the .next/cache directory across builds, but it also prevents
|
||||||
else echo "Lockfile not found." && exit 1; \
|
# .next/cache/fetch-cache from being included in the final image, meaning
|
||||||
|
# cached fetch responses from the build won't be available at runtime.
|
||||||
|
RUN if [ -f package-lock.json ]; then \
|
||||||
|
npm run build; \
|
||||||
|
elif [ -f yarn.lock ]; then \
|
||||||
|
corepack enable yarn && yarn build; \
|
||||||
|
elif [ -f pnpm-lock.yaml ]; then \
|
||||||
|
corepack enable pnpm && pnpm build; \
|
||||||
|
else \
|
||||||
|
echo "No lockfile found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# ============================================
|
||||||
FROM base AS runner
|
# Stage 3: Run Next.js application
|
||||||
|
# ============================================
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION} AS runner
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Set production environment variables
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
ENV PORT=3000
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
|
# Next.js collects completely anonymous telemetry data about general usage.
|
||||||
|
# Learn more here: https://nextjs.org/telemetry
|
||||||
|
# Uncomment the following line in case you want to disable telemetry during the run time.
|
||||||
# ENV NEXT_TELEMETRY_DISABLED=1
|
# ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
# Copy production assets
|
||||||
RUN adduser --system --uid 1001 nextjs
|
COPY --from=builder --chown=node:node /app/public ./public
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
# Set the correct permission for prerender cache
|
||||||
|
RUN mkdir .next
|
||||||
|
RUN chown node:node .next
|
||||||
|
|
||||||
# Automatically leverage output traces to reduce image size
|
# Automatically leverage output traces to reduce image size
|
||||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=node:node /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
|
||||||
|
|
||||||
USER nextjs
|
# If you want to persist the fetch cache generated during the build so that
|
||||||
|
# cached responses are available immediately on startup, uncomment this line:
|
||||||
|
# COPY --from=builder --chown=node:node /app/.next/cache ./.next/cache
|
||||||
|
|
||||||
|
# Switch to non-root user for security best practices
|
||||||
|
USER node
|
||||||
|
|
||||||
|
# Expose port 3000 to allow HTTP traffic
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENV PORT=3000
|
# Start Next.js standalone server
|
||||||
|
|
||||||
# server.js is created by next build from the standalone output
|
|
||||||
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output
|
|
||||||
ENV HOSTNAME="0.0.0.0"
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||||
|
|
||||||
|
const eslintConfig = defineConfig([
|
||||||
|
...nextVitals,
|
||||||
|
globalIgnores([".next/**", "out/**", "build/**"]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
|
images: {
|
||||||
|
qualities: [75, 100],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
Generated
+2042
-780
File diff suppressed because it is too large
Load Diff
+9
-9
@@ -3,14 +3,14 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/env": "15.2.4",
|
"@next/env": "^16.2.10",
|
||||||
"@next/third-parties": "15.2.4",
|
"@next/third-parties": "^16.2.10",
|
||||||
"@radix-ui/react-accordion": "^1.2.3",
|
"@radix-ui/react-accordion": "^1.2.3",
|
||||||
"@vercel/analytics": "^1.4.1",
|
"@vercel/analytics": "^1.4.1",
|
||||||
"@vercel/speed-insights": "^1.1.0",
|
"@vercel/speed-insights": "^1.1.0",
|
||||||
@@ -18,17 +18,17 @@
|
|||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"lucide-react": "^0.487.0",
|
"lucide-react": "^0.487.0",
|
||||||
"motion": "^11.16.0",
|
"motion": "^11.16.0",
|
||||||
"next": "15.2.4",
|
"next": "^16.2.10",
|
||||||
"react": "19.1.0",
|
"react": "^19.2.7",
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "^19.2.7",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"tailwind-merge": "^3.1.0",
|
"tailwind-merge": "^3.1.0",
|
||||||
"tw-animate-css": "^1.2.5"
|
"tw-animate-css": "^1.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4.1.1",
|
"@tailwindcss/postcss": "^4.1.1",
|
||||||
"eslint": "^8",
|
"eslint": "^9.39.5",
|
||||||
"eslint-config-next": "15.2.4",
|
"eslint-config-next": "^16.2.10",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
"tailwindcss": "^4.1.1"
|
"tailwindcss": "^4.1.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,14 @@ export default function Navbar() {
|
|||||||
setDropdownActive(!isDropdownActive);
|
setDropdownActive(!isDropdownActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
function useOutsideAlerter(ref) {
|
const wrapperRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
/**
|
/**
|
||||||
* Alert if clicked on outside of element
|
* Close the menu if clicked on outside of element
|
||||||
*/
|
*/
|
||||||
function handleClickOutside(event) {
|
function handleClickOutside(event) {
|
||||||
if (ref.current && !ref.current.contains(event.target)) {
|
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
||||||
setActive(true);
|
setActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,11 +41,7 @@ export default function Navbar() {
|
|||||||
// Unbind the event listener on clean up
|
// Unbind the event listener on clean up
|
||||||
document.removeEventListener("mousedown", handleClickOutside);
|
document.removeEventListener("mousedown", handleClickOutside);
|
||||||
};
|
};
|
||||||
}, [ref]);
|
}, []);
|
||||||
}
|
|
||||||
|
|
||||||
const wrapperRef = useRef(null);
|
|
||||||
useOutsideAlerter(wrapperRef);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className={`${styles.navbar} shadow-sm`}>
|
<nav className={`${styles.navbar} shadow-sm`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user