Replace flagcdn.com with local flag-icons package

This commit is contained in:
2026-06-11 23:58:09 -03:00
parent 1a1568eb10
commit 768257c286
3 changed files with 8 additions and 10 deletions
+2 -1
View File
@@ -25,7 +25,8 @@
"next": "^14.2.5", "next": "^14.2.5",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5",
"flag-icons": "^7.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/bcryptjs": "^2.4.6", "@types/bcryptjs": "^2.4.6",
+1
View File
@@ -1,6 +1,7 @@
import type { Metadata, Viewport } from 'next' import type { Metadata, Viewport } from 'next'
import { Inter } from 'next/font/google' import { Inter } from 'next/font/google'
import './globals.css' import './globals.css'
import 'flag-icons/css/flag-icons.min.css'
const inter = Inter({ subsets: ['latin'] }) const inter = Inter({ subsets: ['latin'] })
+5 -9
View File
@@ -8,18 +8,14 @@ interface FlagProps {
} }
export function Flag({ isoCode, name, size = 32, className = '' }: FlagProps) { export function Flag({ isoCode, name, size = 32, className = '' }: FlagProps) {
const width = size * 1.5 const width = Math.round(size * 1.5)
const height = size const height = size
return ( return (
// eslint-disable-next-line @next/next/no-img-element <span
<img className={`fi fi-${isoCode.toLowerCase()} ${className}`}
src={`https://flagcdn.com/w${width}/${isoCode}.png`} title={name}
alt={name ? `Bandera de ${name}` : isoCode} style={{ width, height, display: 'inline-block', backgroundSize: 'cover', borderRadius: 2 }}
width={width}
height={height}
className={`object-cover rounded-sm ${className}`}
style={{ width, height }}
/> />
) )
} }