Footer mínimo
Una sola línea: marca, enlaces y volver arriba.
Código completo
Es exactamente el archivo que se descarga. Cópialo a tu proyecto y úsalo.
/**
* Footer mínimo de una sola línea: marca, enlaces y un enlace para volver arriba. Se parte en dos líneas en pantallas estrechas.
*
* <MinimalFooter brand="Estudio Lumen" links={[{ label: "Privacidad", href: "/privacidad" }, { label: "Contacto", href: "/contacto" }]} />
*/
import type { CSSProperties } from "react";
export type FooterLink = { label: string; href: string };
export type MinimalFooterProps = {
brand?: string;
links?: FooterLink[];
/** Texto del enlace para volver arriba. Pasa null para ocultarlo. */
topLabel?: string | null;
className?: string;
style?: CSSProperties;
};
const CSS = `
.gcfm-root { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 32px; box-sizing: border-box; padding: 22px clamp(20px, 4vw, 48px); border-top: 1px solid #dcdce2; background: #fff; color: #5a5a66; font-family: inherit; font-size: 14px; }
.gcfm-brand { color: #17171c; font-weight: 700; letter-spacing: -.01em; }
.gcfm-brand small { margin-left: 10px; color: #7b7b88; font-size: 13px; font-weight: 500; letter-spacing: 0; }
.gcfm-nav { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0; padding: 0; list-style: none; }
.gcfm-nav a, .gcfm-top { position: relative; color: inherit; text-decoration: none; transition: color .2s; }
.gcfm-nav a::after, .gcfm-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.gcfm-nav a:hover, .gcfm-top:hover { color: #17171c; }
.gcfm-nav a:hover::after, .gcfm-top:hover::after { transform: scaleX(1); }
.gcfm-nav a:focus-visible, .gcfm-top:focus-visible { outline: 2px solid #17171c; outline-offset: 4px; border-radius: 2px; }
.gcfm-top { display: inline-flex; align-items: center; gap: 6px; }
.gcfm-top svg { width: 14px; height: 14px; transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.gcfm-top:hover svg { transform: translateY(-3px); }
@media (prefers-reduced-motion: reduce) { .gcfm-nav a::after, .gcfm-top::after, .gcfm-top svg { transition: none; } }
`;
export function MinimalFooter({
brand = "Estudio Lumen",
links = [{ label: "Privacidad", href: "#privacidad" }, { label: "Términos", href: "#terminos" }, { label: "Contacto", href: "#contacto" }],
topLabel = "Volver arriba",
className,
style,
}: MinimalFooterProps) {
const year = new Date().getFullYear();
return (
<>
<style>{CSS}</style>
<footer className={["gcfm-root", className].filter(Boolean).join(" ")} style={style}>
<span className="gcfm-brand">{brand}<small>© {year}</small></span>
<ul className="gcfm-nav">{links.map((link) => <li key={link.href}><a href={link.href}>{link.label}</a></li>)}</ul>
{topLabel ? (
<a className="gcfm-top" href="#top">{topLabel}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7" /></svg></a>
) : null}
</footer>
</>
);
}
Úsalo en tu proyecto
Instálalo con la CLI de shadcn.
npx shadcn@latest add https://www.gassierconsulting.com/r/footer-minimalEjemplo de uso de Footer mínimo
Después de copiar minimal-footer.tsx a tu proyecto, impórtalo y colócalo donde lo necesites.
import { MinimalFooter } from "./minimal-footer";
export default function Ejemplo() {
return <MinimalFooter brand="Ejemplo" />;
}Propiedades de MinimalFooter
MinimalFooter acepta 5 propiedades: todas son opcionales y tienen un valor por defecto, así que funciona sin configurar nada.
| Propiedad | Tipo | Descripción |
|---|---|---|
brand? | string | Opcional. |
links? | FooterLink[] | Opcional. |
topLabel? | string | null | Texto del enlace para volver arriba. Pasa null para ocultarlo. |
className? | string | Opcional. |
style? | CSSProperties | Opcional. |
Accesibilidad y rendimiento
El archivo tiene 58 líneas (3 KB) y no necesita @keyframes. Esto es lo que hace Footer mínimo por quien lo usa:
- Detecta prefers-reduced-motion y baja o quita el movimiento cuando la persona lo pide.
- Muestra un anillo de foco visible al navegar con teclado (:focus-visible).
- Expone su estado a tecnologías de apoyo con atributos aria-*.
Acerca del producto
Un footer discreto de una línea con la marca y el año, enlaces con subrayado que se dibuja al pasar el puntero y un enlace para volver arriba. En pantallas estrechas pasa a dos líneas.
Incluye
Una sección completa en un solo archivo React + TypeScript, con los estilos dentro. No usa Tailwind ni bibliotecas externas.
- Marca, año y enlaces configurables
- Enlace opcional para volver arriba
- Subrayado animado en los enlaces
- Sin JavaScript
Cómo usarlo
Pasa brand, links y topLabel (null para ocultar el enlace de volver arriba). El destino #top requiere un elemento con id="top" o la raíz de la página.