Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.18.2"
Expand Down
113 changes: 113 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,117 @@ html[data-theme="dark"] .navbar-link {
.footer-links {
gap: 1rem;
}
}

/* Card Component */
.cards-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
text-align: left;
}

.card {
display: flex;
flex-direction: column;
background-color: #ffffff;
border: 1px solid #e5e5e5;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
transition: transform 0.2s ease, box-shadow 0.2s ease;
text-align: left;
}

.card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.card-image-wrapper {
width: 100%;
height: 180px;
overflow: hidden;
background-color: #f3f3f3;
}

.card-image {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}

.card-content {
padding: 1.25rem;
display: flex;
flex-direction: column;
flex: 1;
gap: 0.75rem;
}

.card-title {
margin: 0;
font-size: 1.15rem;
font-weight: 600;
color: #213547;
}

.card-description {
margin: 0;
font-size: 0.95rem;
line-height: 1.5;
color: #555;
}

.card-action {
margin-top: auto;
padding-top: 0.5rem;
}

.card-button {
display: inline-block;
padding: 0.55rem 1.1rem;
background-color: #8e8dd3;
color: #ffffff;
text-decoration: none;
border-radius: 6px;
font-weight: 500;
font-size: 0.9rem;
border: none;
cursor: pointer;
text-align: center;
transition: background-color 0.2s ease, transform 0.1s ease;
}

.card-button:hover {
background-color: #7978c2;
}

.card-button:active {
transform: scale(0.98);
}

/* Dark Mode for Card */
html[data-theme="dark"] .card {
background-color: #1a1a1a;
border-color: #2e2e2e;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .card:hover {
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .card-image-wrapper {
background-color: #262626;
}

html[data-theme="dark"] .card-title {
color: #f0f0f0;
}

html[data-theme="dark"] .card-description {
color: #a0aec0;
}
90 changes: 90 additions & 0 deletions src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import PropTypes from "prop-types";

function Card({
title,
description,
image,
imageAlt,
actionText,
buttonText,
actionLink,
buttonLink,
onAction,
onButtonClick,
action,
children,
className = "",
...props
}) {
const finalActionText = actionText || buttonText;
const finalActionLink = actionLink || buttonLink;
const finalOnAction = onAction || onButtonClick;

return (
<div className={`card ${className}`.trim()} {...props}>
{image && (
<div className="card-image-wrapper">
<img
src={image}
alt={imageAlt || (typeof title === "string" ? title : "Card image")}
className="card-image"
/>
</div>
)}

<div className="card-content">
{title && <h3 className="card-title">{title}</h3>}
{description && <p className="card-description">{description}</p>}
{children}

{(action || finalActionText) && (
<div className="card-action">
{action ? (
action
) : finalActionLink ? (
<a
href={finalActionLink}
className="card-button"
onClick={finalOnAction}
target={finalActionLink.startsWith("http") ? "_blank" : undefined}
rel={
finalActionLink.startsWith("http")
? "noopener noreferrer"
: undefined
}
>
{finalActionText}
</a>
) : (
<button
type="button"
className="card-button"
onClick={finalOnAction}
>
{finalActionText}
</button>
)}
</div>
)}
</div>
</div>
);
}

Card.propTypes = {
title: PropTypes.node,
description: PropTypes.node,
image: PropTypes.string,
imageAlt: PropTypes.string,
actionText: PropTypes.node,
buttonText: PropTypes.node,
actionLink: PropTypes.string,
buttonLink: PropTypes.string,
onAction: PropTypes.func,
onButtonClick: PropTypes.func,
action: PropTypes.node,
children: PropTypes.node,
className: PropTypes.string,
};

export default Card;
57 changes: 37 additions & 20 deletions src/components/Welcome.jsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
import Card from "./Card.jsx";

function Welcome() {
return (
<section className="welcome">
<h1>Welcome to React Open Source Starter</h1>
<section className="welcome">
<h1>Welcome to React Open Source Starter</h1>

<p>
This project is specially created to help new contributors make
their first open source contribution.
</p>

<p>
This project is specially created to help new contributors make
their first open source contribution.
</p>
<p>
You can create a new component, add a feature, fix a bug, improve
the UI, or make any other useful improvement — then submit a
Pull Request.
</p>

<p>
You can create a new component, add a feature, fix a bug, improve
the UI, or make any other useful improvement — then submit a
Pull Request.
</p>
<div className="cards-grid">
<Card
title="React Components"
description="Build reusable, modular UI components to strengthen your React skills."
actionText="Explore Repository"
actionLink="https://github.com/Vikram-sardiwal/react-open-source"
/>
<Card
title="Contribute"
description="Learn how to create pull requests, follow guidelines, and collaborate."
actionText="Read Guidelines"
actionLink="https://github.com/Vikram-sardiwal/react-open-source/blob/main/CONTRIBUTING.md"
/>
</div>

<p>
Please check <code>CONTRIBUTING.md</code> for contribution
guidelines and instructions.
</p>
<p>
Please check <code>CONTRIBUTING.md</code> for contribution
guidelines and instructions.
</p>

<p>
<strong>Created and maintained by Vikram Sardiwal.</strong>
</p>
</section>
);
<p>
<strong>Created and maintained by Vikram Sardiwal.</strong>
</p>
</section>
);
}

export default Welcome;