From 5ed431db2c4a45b35fe1ab9e6d8a69ca62bbbeb5 Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sat, 27 Jun 2026 22:14:56 +0530 Subject: Added react/04-components sample project --- react/04-components/src/App.jsx | 20 ++++++++++++++++++++ react/04-components/src/assets/hero.png | Bin 0 -> 13057 bytes react/04-components/src/assets/react.svg | 1 + react/04-components/src/assets/vite.svg | 1 + .../src/components/MyOtherComponent.jsx | 14 ++++++++++++++ react/04-components/src/components/Navbar.jsx | 9 +++++++++ react/04-components/src/index.css | 0 react/04-components/src/main.jsx | 10 ++++++++++ 8 files changed, 55 insertions(+) create mode 100644 react/04-components/src/App.jsx create mode 100644 react/04-components/src/assets/hero.png create mode 100644 react/04-components/src/assets/react.svg create mode 100644 react/04-components/src/assets/vite.svg create mode 100644 react/04-components/src/components/MyOtherComponent.jsx create mode 100644 react/04-components/src/components/Navbar.jsx create mode 100644 react/04-components/src/index.css create mode 100644 react/04-components/src/main.jsx (limited to 'react/04-components/src') diff --git a/react/04-components/src/App.jsx b/react/04-components/src/App.jsx new file mode 100644 index 0000000..5459c80 --- /dev/null +++ b/react/04-components/src/App.jsx @@ -0,0 +1,20 @@ +import Navbar from "./components/Navbar"; +import MyOtherComponent from "./components/MyOtherComponent"; + +function App() { + return ( + <> + + + + This is component 1 description. + + + + This is component 2 description. + + + ) +} + +export default App diff --git a/react/04-components/src/assets/hero.png b/react/04-components/src/assets/hero.png new file mode 100644 index 0000000..02251f4 Binary files /dev/null and b/react/04-components/src/assets/hero.png differ diff --git a/react/04-components/src/assets/react.svg b/react/04-components/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/react/04-components/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/react/04-components/src/assets/vite.svg b/react/04-components/src/assets/vite.svg new file mode 100644 index 0000000..5101b67 --- /dev/null +++ b/react/04-components/src/assets/vite.svg @@ -0,0 +1 @@ +Vite diff --git a/react/04-components/src/components/MyOtherComponent.jsx b/react/04-components/src/components/MyOtherComponent.jsx new file mode 100644 index 0000000..1dc5c68 --- /dev/null +++ b/react/04-components/src/components/MyOtherComponent.jsx @@ -0,0 +1,14 @@ +import React from 'react' + +const MyOtherComponent = ({title, children}) => { + return ( + <> +
+
{title}
+
{children}
+
+ + ) +} + +export default MyOtherComponent \ No newline at end of file diff --git a/react/04-components/src/components/Navbar.jsx b/react/04-components/src/components/Navbar.jsx new file mode 100644 index 0000000..afa1f4d --- /dev/null +++ b/react/04-components/src/components/Navbar.jsx @@ -0,0 +1,9 @@ +import React from 'react' + +const Navbar = () => { + return ( +
Navbar
+ ) +} + +export default Navbar \ No newline at end of file diff --git a/react/04-components/src/index.css b/react/04-components/src/index.css new file mode 100644 index 0000000..e69de29 diff --git a/react/04-components/src/main.jsx b/react/04-components/src/main.jsx new file mode 100644 index 0000000..b9a1a6d --- /dev/null +++ b/react/04-components/src/main.jsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import './index.css' +import App from './App.jsx' + +createRoot(document.getElementById('root')).render( + + + , +) -- cgit v1.2.3