Navbar
Navbar
// NavigationBar Component
const NavigationBar = () => {
return (
<nav style={styles.navbar}>
<a href="#home" style={styles.link}>Home</a>
<a href="#about" style={styles.link}>About</a>
<a href="#projects" style={styles.link}>Projects</a>
<a href="#contact" style={styles.link}>Contact</a>
</nav>
);
};
// App Component
const App = () => {
return (
<div>
<NavigationBar />
<div style={styles.content}>
<h1>Welcome to My Website</h1>
<p>This is a simple personal site with a custom navigation bar!</p>
</div>
</div>
);
};
// Styling Object
const styles = {
navbar: {
display: 'flex',
justifyContent: 'center',
backgroundColor: '#333',
padding: '10px',
position: 'sticky',
top: 0,
zIndex: 1000,
},
link: {
color: '#fff',
textDecoration: 'none',
margin: '0 15px',
fontSize: '16px',
},
content: {
textAlign: 'center',
marginTop: '20px',
padding: '10px',
},
};
// Render App
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);