Skip to content

Commit

Permalink
FS-94 Add Nav bar (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
mic-smith authored Nov 12, 2024
1 parent 1a1d212 commit 8849b54
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap"
rel="stylesheet"
/>
</head>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import styles from './app.module.css';
import { Chat } from './components/chat';
import { Input } from './components/input';
import { useMessages } from './useMessages';
import { NavBar } from './components/navbar';

export const App = () => {
const { sendMessage, messages, waiting } = useMessages();

return (
<div className={styles.container}>
<NavBar />
<Chat messages={messages} waiting={waiting} />
<Input sendMessage={sendMessage} waiting={waiting} />
</div>
Expand Down
42 changes: 42 additions & 0 deletions frontend/src/components/button.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.button_container {
background-color: var(--primary);
border-radius: 20px;
}

.button {
height: 40px;
box-sizing: border-box;
color: var(--grey-900);
font-weight: 700;
font-size: 16px;
line-height: 20px;
border-radius: 20px;
border: none;
padding: 0 24px;
background-color: transparent;
display: inline-flex;
align-items: center;
}

.button:hover {
background-color: rgb(255 255 255 / 0.15);
box-shadow: 0 1px 4px 0 rgb(0 0 0 / 0.2);
cursor: pointer;
}

.button:active:enabled {
background-color: var(--primary-dark);
}

.button_container:has(.button:disabled) {
background-color: var(--grey-400);
opacity: 0.5;
}

.icon {
margin-right: 8px;
}

.button:has(.icon) {
padding-left: 16px;
}
20 changes: 20 additions & 0 deletions frontend/src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import styles from './button.module.css';

interface ButtonProps {
text: string;
icon?: string;
disabled?: boolean;
onClick: () => void;
}

export const Button = ({ text, icon, disabled, onClick }: ButtonProps) => {
return (
<div className={styles.button_container}>
<button disabled={disabled} className={styles.button} onClick={onClick}>
{icon && <img src={icon} className={styles.icon} />}
{text}
</button>
</div>
);
};
10 changes: 10 additions & 0 deletions frontend/src/components/navbar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.container {
width: 100%;
height: 80px;
padding: 0 36px;
background-color: var(--grey-900);
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
}
24 changes: 24 additions & 0 deletions frontend/src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import styles from './navbar.module.css';
import ChatIcon from '../icons/chat.svg';
import { Button } from './button';
import logo from '../icons/primary-logo-dark.svg';

export const NavBar = () => {
return (
<div className={styles.container}>
<div>
<img src={logo} title="Infer ESG" />
</div>
<div>
<Button
icon={ChatIcon}
text="Start new chat"
onClick={() => {
console.log('Start new chat');
}}
/>
</div>
</div>
);
};
17 changes: 16 additions & 1 deletion frontend/src/styles.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
html,
body,
#app-root {
font-family: 'Source Sans 3', sans-serif;
font-family: 'Roboto', sans-serif;
height: 100%;
margin: 0;

--primary: #f29900;
--primary-dark: #f28900;
--grey-50: #faf7f5;
--grey-100: #f5f2f0;
--grey-200: #eeebe9;
--grey-300: #e0dddc;
--grey-400: #bdbbb9;
--grey-500: #9e9c9b;
--grey-600: #757473;
--grey-700: #62605f;
--grey-800: #424141;
--grey-900: #212120;
--black: #000000;
--white: #ffffff;

--background-color-primary: #282828;
--blue: #007bff;
--border-primary: #424242;
Expand Down

0 comments on commit 8849b54

Please sign in to comment.