Skip to content

Commit

Permalink
add features and responsive (#2284)
Browse files Browse the repository at this point in the history
* Update app.css

* add feature

* add link tag
  • Loading branch information
Pravakarcoder committed Jun 20, 2024
1 parent e6056d0 commit f538504
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 19 deletions.
3 changes: 2 additions & 1 deletion examples/simple/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Head from 'next/head'
import type { FC } from 'react'
import Link from 'next/link'

type Props = {
heading: string
Expand All @@ -16,7 +17,7 @@ export const Header: FC<Props> = ({ heading, title }) => (
<hr />
</h2>
<h1>{heading}</h1>
<a className="github" href="//github.com/i18next/next-i18next">
<Link className="github" href="//github.com/i18next/next-i18next">
<i className="typcn typcn-social-github-circular" />
</a>
</>
Expand Down
34 changes: 16 additions & 18 deletions examples/simple/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Homepage = (

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const clientSideLanguageChange = (newLocale: string) => {
i18n.changeLanguage(newLocale);
i18n.changeLanguage(newLocale)
}

const changeTo = router.locale === 'en' ? 'de' : 'en'
Expand All @@ -36,30 +36,30 @@ const Homepage = (
<>
<main>
<Header heading={t('h1')} title={t('title')} />
<div style={{ display: 'inline-flex', width: '90%' }}>
<div style={{ width: '33%' }}>
<h3 style={{ minHeight: 70 }}>
<div className="mainBox">
<div className="card">
<h3 className="card-title">
{t('blog.appDir.question')}
</h3>
<p>
<p className="card-text">
<Trans i18nKey="blog.appDir.answer">
Then check out
<a href={t('blog.appDir.link')}>this blog post</a>
.
<a href={t('blog.appDir.link')}>this blog post</a>.
</Trans>
</p>
<a href={t('blog.appDir.link')}>
<img
style={{ width: '50%' }}
className="card-img"
src="https://locize.com/blog/next-app-dir-i18n/next-app-dir-i18n.jpg"
/>
</a>
</div>
<div style={{ width: '33%' }}>
<h3 style={{ minHeight: 70 }}>

<div className="card">
<h3 className="card-title">
{t('blog.optimized.question')}
</h3>
<p>
<p className="card-text">
<Trans i18nKey="blog.optimized.answer">
Then you may have a look at
<a href={t('blog.optimized.link')}>this blog post</a>
Expand All @@ -68,24 +68,22 @@ const Homepage = (
</p>
<a href={t('blog.optimized.link')}>
<img
style={{ width: '50%' }}
className="card-img"
src="https://locize.com/blog/next-i18next/next-i18next.jpg"
/>
</a>
</div>
<div style={{ width: '33%' }}>
<h3 style={{ minHeight: 70 }}>
{t('blog.ssg.question')}
</h3>
<p>
<div className="card">
<h3 className="card-title">{t('blog.ssg.question')}</h3>
<p className="card-text">
<Trans i18nKey="blog.ssg.answer">
Then you may have a look at
<a href={t('blog.ssg.link')}>this blog post</a>.
</Trans>
</p>
<a href={t('blog.ssg.link')}>
<img
style={{ width: '50%' }}
className="card-img"
src="https://locize.com/blog/next-i18n-static/title.jpg"
/>
</a>
Expand Down
86 changes: 86 additions & 0 deletions examples/simple/public/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
min-width: 100vw;
}

* body {
overflow-x: hidden; /* Hide x-axis overflow */
}

h1,
h2 {
font-family: 'Oswald', sans-serif;
Expand All @@ -35,6 +39,87 @@ h3 {
opacity: 0.5;
}

.mainBox {
display: grid;
gap: 20px;
width: 90%;
grid-template-columns: 1fr;
grid-auto-rows: auto;
}

.card {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
text-align: center;
box-sizing: border-box;
transition: box-shadow 0.3s ease; /* Smooth transition for the hover effect */
display: grid;
grid-template-rows: auto 1fr auto;
}

.card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Increased shadow on hover */
}

.card-title {
padding-top: 11px;
min-height: 70px;
font-size: 1.5em;
margin: 0 0 10px;
}

.card-text {
font-size: 1em;
color: #666;
margin-bottom: 15px;
padding: 0 10px; /* Add padding for text inside the card */
}

.card-text a {
color: #007bff;
text-decoration: none;
}

.card-text a:hover {
text-decoration: underline;
}

.card-img {
width: 100%; /* Full width of the parent div */
height: auto; /* Maintain aspect ratio */
border-radius: 0 0 10px 10px; /* Rounded corners on the bottom only */
display: block; /* Prevent extra space below the image */
transition:
transform 0.5s ease,
box-shadow 0.5s ease; /* Smooth transition for hover effects with longer duration */
}

.card-img:hover {
transform: scale(1.05); /* Slightly scale up the image */
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Add a subtle shadow */
}

/* Media queries for responsive design */
@media (min-width: 600px) {
.mainBox {
grid-template-columns: repeat(
2,
1fr
); /* Show 2 cards per row on medium screens */
}
}

@media (min-width: 900px) {
.mainBox {
grid-template-columns: repeat(
3,
1fr
); /* Show 3 cards per row on large screens */
}
}

p {
line-height: 1.65em;
}
Expand Down Expand Up @@ -73,6 +158,7 @@ button {
min-height: 40px;
padding: 0 0.8em;
border: 0;
border-radius: 5px;
color: inherit;
position: relative;
transform: translateZ(0);
Expand Down

0 comments on commit f538504

Please sign in to comment.