diff --git a/package-lock.json b/package-lock.json index 60164f1..3df268a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "react-open-source", "version": "0.1.0", "dependencies": { + "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^7.18.2" @@ -3657,7 +3658,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -3950,7 +3950,6 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, "license": "MIT", "dependencies": { "loose-envify": "^1.4.0", @@ -4020,7 +4019,6 @@ "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true, "license": "MIT" }, "node_modules/react-refresh": { diff --git a/package.json b/package.json index b97fb2f..f54c7bc 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/App.css b/src/App.css index 73a237a..97bb7be 100644 --- a/src/App.css +++ b/src/App.css @@ -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; } \ No newline at end of file diff --git a/src/components/Card.jsx b/src/components/Card.jsx new file mode 100644 index 0000000..39e34fd --- /dev/null +++ b/src/components/Card.jsx @@ -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 ( +
{description}
} + {children} + + {(action || finalActionText) && ( ++ This project is specially created to help new contributors make + their first open source contribution. +
-- This project is specially created to help new contributors make - their first open source contribution. -
++ 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. +
-- 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. -
+
- Please check CONTRIBUTING.md for contribution
- guidelines and instructions.
-
+ Please check CONTRIBUTING.md for contribution
+ guidelines and instructions.
+
- Created and maintained by Vikram Sardiwal. -
-+ Created and maintained by Vikram Sardiwal. +
+