Skip to content

Commit 6b9054f

Browse files
author
Darío Espinoza
committed
feat: Enhance Footer component with internationalization support and dynamic content rendering
1 parent 2304580 commit 6b9054f

6 files changed

Lines changed: 32 additions & 14 deletions

File tree

components/footer.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1+
import { PageProps } from "$fresh/server.ts";
12
import AnchorLang from "../islands/AnchorLang.tsx";
2-
export default function Footer() {
3+
import translations from "../locales/es.json" with { type: "json" };
4+
interface State {
5+
state: { lang: string; translations: typeof translations };
6+
}
7+
export default function Footer({ state }: PageProps<State>) {
8+
const { lang: _lang, translations } = state;
39
return (
410
<footer class="text-center text-xs w-full py-1 mt-10">
511
<AnchorLang />
6-
<div class="py-1">
7-
Desarrollado por <a class="mx-1 text-blue-400" rel="noopener noreferrer" target="_blank" href="https://www.linkedin.com/in/darioesp/">@darioesp</a>
8-
Con cariño desde un rincón de
9-
<svg class="ml-1 inline" version="1.1" width="15px" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 64 42" xml:space="preserve"><path id="Rounded_Rectangle_7_copy" fill="#FFFFFF" d="M5.8,0h52.3C61.4,0,64,2.6,64,5.7v30.6c0,3.2-2.6,5.7-5.8,5.7H5.8 C2.6,42,0,39.4,0,36.3V5.7C0,2.6,2.6,0,5.8,0z"></path> <path fill="#D42E12" d="M0,36.3C0,39.4,2.6,42,5.8,42h52.4c3.2,0,5.8-2.5,5.8-5.7V21H0V36.3z"></path> <path fill="#0034A8" d="M21,0H5.8C2.6,0,0,2.6,0,5.7V21h21V0z"></path> <polygon fill="#FFFFFF" points="10.8,4.9 12.3,9.8 17.4,9.8 13.3,12.7 14.9,17.6 10.8,14.6 6.6,17.6 8.2,12.7 4.1,9.8 9.2,9.8 "></polygon> </svg>
12+
<div
13+
class="py-1"
14+
dangerouslySetInnerHTML={{
15+
__html: translations.index.footer.development
16+
}}
17+
>
1018
</div>
11-
<div class="px-4 mt-1">
12-
Creado por
13-
<a class="mx-1 text-cyan-600" rel="noopener noreferrer" target="_blank" href="https://x.com/peterwong_xyz/status/1898090027873452542">@peterwong_xyz</a>
14-
y traducido al español por <a class="ml-1 text-cyan-600" rel="noopener noreferrer" target="_blank" href="https://x.com/midudev" >@midudev</a>
19+
<div
20+
class="py-1"
21+
dangerouslySetInnerHTML={{
22+
__html: translations.index.footer.created
23+
}}
24+
>
1525
</div>
1626
</footer>
1727
);

locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
"Balance quick development with architectural considerations"
6565
]
6666
}
67-
]
67+
],
68+
"footer": {
69+
"development": "Developed by <a class='mx-1 text-blue-400' rel='noopener noreferrer' target='_blank' href='https://www.linkedin.com/in/darioesp/'>@darioesp</a> With love from a corner of <svg class='ml-1 inline' version='1.1' width='15px' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='0 0 64 42' xml:space='preserve'><path fill='#FFFFFF' d='M5.8,0h52.3C61.4,0,64,2.6,64,5.7v30.6c0,3.2-2.6,5.7-5.8,5.7H5.8 C2.6,42,0,39.4,0,36.3V5.7C0,2.6,2.6,0,5.8,0z'></path> <path fill='#D42E12' d='M0,36.3C0, 39.4, 2.6, 42, 5.8, 42h52.4c3.2, 0, 5.8-2.5, 5.8-5.7V21H0V36.3z'></path> <path fill='#0034A8' d='M21, 0H5.8C2.6, 0, 0, 2.6, 0, 5.7V21h21V0z'></path> <polygon fill='#FFFFFF' points='10.8,4.9 12.3, 9.8 17.4, 9.8 13.3, 12.7 14.9, 17.6 10.8, 14.6 6.6, 17.6 8.2, 12.7 4.1, 9.8 9.2, 9.8'></polygon> </svg>",
70+
"created": "Created by <a class='mx-1 text-cyan-600' rel='noopener noreferrer' target='_blank' href='https://x.com/peterwong_xyz/status/1898090027873452542'>@peterwong_xyz</a>"
71+
}
6872
}
6973
}

locales/es.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
"Equilibrar el desarrollo rápido con consideraciones arquitectónicas"
6565
]
6666
}
67-
]
67+
],
68+
"footer": {
69+
"development": "Desarrollado por <a class='mx-1 text-blue-400' rel='noopener noreferrer' target='_blank' href='https://www.linkedin.com/in/darioesp/'>@darioesp</a> Con cariño desde un rincón de <svg class='ml-1 inline' version='1.1' width='15px' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='0 0 64 42' xml:space='preserve'><path fill='#FFFFFF' d='M5.8,0h52.3C61.4,0,64,2.6,64,5.7v30.6c0,3.2-2.6,5.7-5.8,5.7H5.8 C2.6,42,0,39.4,0,36.3V5.7C0,2.6,2.6,0,5.8,0z'></path> <path fill='#D42E12' d='M0,36.3C0, 39.4, 2.6, 42, 5.8, 42h52.4c3.2, 0, 5.8-2.5, 5.8-5.7V21H0V36.3z'></path> <path fill='#0034A8' d='M21, 0H5.8C2.6, 0, 0, 2.6, 0, 5.7V21h21V0z'></path> <polygon fill='#FFFFFF' points='10.8,4.9 12.3, 9.8 17.4, 9.8 13.3, 12.7 14.9, 17.6 10.8, 14.6 6.6, 17.6 8.2, 12.7 4.1, 9.8 9.2, 9.8'></polygon> </svg>",
70+
"created": "Creado por <a class='mx-1 text-cyan-600' rel='noopener noreferrer' target='_blank' href='https://x.com/peterwong_xyz/status/1898090027873452542'>@peterwong_xyz</a> y traducido al español por <a class='ml-1 text-cyan-600' rel='noopener noreferrer' target='_blank' href='https://x.com/midudev' >@midudev</a> </div>"
71+
}
6872
}
6973
}

routes/[lang]/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function Home({ state }: PageProps<State>) {
4747
</section>
4848
</SectionWrapperContent>
4949
</WrapperPage>
50-
<Footer/>
50+
<Footer state={state}/>
5151
</div>
5252
</>
5353
);

routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function Home({ state }: PageProps<State>) {
4444
</section>
4545
</SectionWrapperContent>
4646
</WrapperPage>
47-
<Footer />
47+
<Footer state={state}/>
4848
</div>
4949
</>
5050
);

tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Config } from "tailwindcss";
22

33
export default {
44
content: [
5-
"{routes,islands,components}/**/*.{ts,tsx,js,jsx}",
5+
"{routes,islands,components,locales}/**/*.{ts,tsx,js,jsx,json}",
66
],
77
darkMode: "class", // Enables dark mode using the "class" strategy
88
theme: {

0 commit comments

Comments
 (0)