Skip to content

Commit

Permalink
Inline logo as SVG 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
wotschofsky committed Sep 30, 2023
1 parent abbc543 commit dee4ac6
Show file tree
Hide file tree
Showing 6 changed files with 1,874 additions and 102 deletions.
12 changes: 12 additions & 0 deletions assets/logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions assets/logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import Link from 'next/link';

import LogoDark from '@/assets/logo-dark.svg';
import LogoLight from '@/assets/logo-light.svg';
import ThemeMenu from '@/components/ThemeMenu';

const Header = () => (
<header className="w-full p-4 md:px-8">
<div className="flex items-center justify-between pb-4">
<Link className="flex items-center gap-2" href="/">
<img className="inline h-6" src="/icon.svg" alt="" /> Domain Digger
<LogoDark className="inline h-6 dark:hidden" />
<LogoLight className="hidden h-6 dark:inline" />
Domain Digger
</Link>
<ThemeMenu />
</div>
Expand Down
31 changes: 31 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack(config, { isServer }) {
// Configures webpack to handle SVG files with SVGR. SVGR optimizes and transforms SVG files
// into React components. See https://react-svgr.com/docs/next/

// Grab the existing rule that handles SVG imports
// @ts-ignore - rules is a private property that is not typed
const fileLoaderRule = config.module.rules.find((rule) =>
rule.test?.test?.('.svg')
);

config.module.rules.push(
// Reapply the existing rule, but only for svg imports ending in ?url
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
// Convert all other *.svg imports to React components
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: ['@svgr/webpack'],
}
);

// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;

return config;
},
};

module.exports = nextConfig;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"whoiser": "^1.17.1"
},
"devDependencies": {
"@svgr/webpack": "^8.1.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/dns-packet": "^5.6.0",
"@types/leaflet": "^1.9.3",
Expand Down
Loading

1 comment on commit dee4ac6

@vercel
Copy link

@vercel vercel bot commented on dee4ac6 Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

domain-digger – ./

domain-digger-git-main-wotschofsky.vercel.app
www.digger.tools
domain-digger-wotschofsky.vercel.app
digger.tools

Please sign in to comment.