Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Text Field #203

Merged
merged 13 commits into from
Jan 23, 2025
39 changes: 39 additions & 0 deletions front-end/src/components/textfield/TextField.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@use '@styles/_fonts';

.textField {
@include fonts.text-medium;

.label {
color: var(--alt-text);
text-align: left;
}

.container {
display: flex;
align-items: center;
background-color: var(--light-grey);
border-radius: 8px;
padding: 0.5rem;


.title {
color: var(--text-colour);
}

.input {
@include fonts.text-medium;
background: none;
border: none;
outline: none;
color: var(--text-colour);
flex-grow: 1;
padding-left: 0.5rem;
camdnnn marked this conversation as resolved.
Show resolved Hide resolved
text-align: left;
width: 100%;

&::placeholder {
color: var(--alt-text);
}
}
}
}
37 changes: 37 additions & 0 deletions front-end/src/components/textfield/TextField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import styles from './TextField.module.scss';

interface TextFieldProps {
title: string;
value: string;
setValue: (value: string) => void;
label?: string;
placeholder?: string;
}

const TextField = ({
title,
value,
setValue,
label,
placeholder = 'Value',
}: TextFieldProps) => {
return (
<div className={styles.textField}>
{label && <div className={styles.label}>{label}</div>}
<div className={styles.container}>
<div className={styles.title}>
{title}
</div>
<input
className={styles.input}
type="text"
placeholder={placeholder}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</div>
</div>
);
};

export default TextField;
29 changes: 0 additions & 29 deletions front-end/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ function createWindow() {

win.maximize();

// Development
/*
win.loadFile(path.resolve(resourcePath, '../../build/index.html'));
backend = spawn(
'java',
['-jar', path.resolve(resourcePath, '../../../backend/target/backend-1.2.0-runner.jar')],
{ env: { ...process.env, RESOURCE_PATH: resourcePath + '/binary_csv/' } }
);
*/

// Production
win.loadFile(path.resolve(resourcePath, 'build/index.html'));
backend = spawn(
path.resolve(resourcePath, '../backend/jre/bin/java.exe').toString(),
Expand All @@ -39,24 +28,6 @@ function createWindow() {
env: { ...process.env, RESOURCE_PATH: path.resolve(resourcePath, '../backend').toString() + '/' },
},
);

// Conditional file paths
/*
isProduction = app.isPackaged;
const frontendPath = path.resolve(resourcePath, isProduction ? 'build/index.html' : '../../build/index.html');
const backendPath = path.resolve(resourcePath, isProduction ? '../backend' : '../../../backend/target')
const dllPath = path.resolve(resourcePath, isProduction ? '../backend' : '../../../backend/src/main/java/com/mcmasterbaja/binary_csv').toString() + '/';

// Conditional
win.loadFile(frontendPath);
backend = spawn(
path.resolve(backendPath, 'jre/bin/java.exe').toString(),
['-jar', path.resolve(backendPath, 'backend-1.2.0-runner.jar')],
{
env: { ...process.env, RESOURCE_PATH: dllPath },
},
);
*/

win.on('closed', () => win = null);

Expand Down
7 changes: 5 additions & 2 deletions front-end/src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $background: #222222;
$accent: #BB0808;
$text-colour: #FFFFFF;
$upload-stroke: #636363;
$alt-text: #B3B3B3;

// Baja colour
$baja-colour: #75151E;
Expand All @@ -21,6 +22,7 @@ $upload-stroke: #636363;
--text-colour: #{$text-colour};

--light-grey: #{$upload-stroke};
--alt-text: #{$alt-text};
--baja-colour: #{$baja-colour};
--light-grey: #{$upload-stroke};
}
Expand All @@ -33,14 +35,15 @@ $upload-stroke: #636363;
--background: #FFFFFF;
--accent: #BB0808;
--text-colour: #000000;
--alt-text: #B3B3B3;
}

// A map of z-index values for different components
$z-index: (
dropdown: 1,
footer: 1,
sidebar: 2,
success: 3,
tooltip: 4,
modal: 5,
footer: 1,
);
);
Loading