Skip to content

Commit

Permalink
feat(component): Enable TextField to display naked field
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Sep 28, 2024
1 parent 7711d37 commit ff896d1
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 15 deletions.
49 changes: 37 additions & 12 deletions src/components/form/Textfield.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
import React from "react";

const TextField = ({
label,
helptext=null,
required=false,
error_text=null,
value=null
error_text = null,
fieldset = true,
helptext = null,
id = null,
label = null,
onchange = null,
required = false,
value = null
}) => {

return (
<fieldset>
<label className="name">{label}</label>
<input className="common-field" required={required} type="text" placeholder={helptext} value={value == null ? '' : value} />
<span className="error-text">{error_text}</span>
</fieldset>
);
let field = (
<input
className="common-field"
id={id}
onChange={e => {
onchange(e.target.value)
} }
placeholder={helptext}
required={required}
type="text"
value={value == null ? '' : value}
/>
)

if( fieldset == true ) {
return (
<fieldset>
<label className="name">{label}</label>
{field}
<span className="error-text">{error_text}</span>
</fieldset>

);

} else {

return ( field )
}

}

Expand Down
41 changes: 38 additions & 3 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,35 @@ section .content td {
border-bottom: 1px solid var(--border-colour);
}

p.table-pagination {
/* background-color: chartreuse; */
display: inline-block;
padding: 0px
}

p.table-pagination span {
/* background-color: chocolate; */
display: inline-block;
margin: 0px 10px;
}

p.table-pagination span.table-pagination-text {
/* background-color: chocolate; */
}

p.table-pagination span.table-pagination-text input {
/* background-color: chocolate; */
width: 40px;
text-align: center;
margin: 0px 5px;
}


p.table-pagination span.table-pagination-button {
/* background-color: chocolate; */
cursor: pointer;
}

.content form {
display: flexbox;
}
Expand Down Expand Up @@ -1069,19 +1098,25 @@ section .content td {
padding: 5px 0px;
}

.content form fieldset .common-field {
.common-field {
background-color: var(--background-colour-form-field);
color: var(--text-colour);
font-size: inherit;
line-height: 30px;
min-width: 400px;
}

.content form fieldset input {

input.common-field {
border: none;
border-bottom: 1px solid var(--border-colour-form-field);
}


.content form fieldset .common-field {
min-width: 400px;
}


.content form fieldset textarea {
border-color: var(--border-colour-form-field);
}
Expand Down

0 comments on commit ff896d1

Please sign in to comment.