Skip to content

Commit

Permalink
[Upd #56] Refactored with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Jan 28, 2022
1 parent e8bbdb4 commit 3e02e89
Show file tree
Hide file tree
Showing 36 changed files with 196 additions and 425 deletions.
97 changes: 96 additions & 1 deletion css/s-forms.min.css
Original file line number Diff line number Diff line change
@@ -1 +1,96 @@
.checkbox label{font-weight:700}.panel-title .checkbox label{font-weight:400}.answerable-question{color:#31708f;background-color:#d9edf7;border-color:#bce8f1;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px;padding:0 15px}.answerable-subquestions{padding-top:10px;padding-left:2em;border:1px solid #bce8f1;border-bottom-left-radius:4px;border-bottom-right-radius:4px;margin-bottom:18px}svg{fill:currentColor}.caret-square-down,.caret-square-up,.info-circle,.question-circle{height:1rem;margin-bottom:.15rem}.caret-square-down,.caret-square-up{margin-right:.2rem}.help-icon-text-input{margin-bottom:25px;bottom:0}.has-unit-label{margin-bottom:26px;bottom:0;font-weight:700;position:absolute}.tooltip-content{white-space:pre-wrap}.collapse-toggle{margin-right:.3em;line-height:.9}.form-label{font-weight:500}input:disabled{cursor:not-allowed}.cursor-pointer{cursor:pointer}.accordion>.card{overflow:visible}.react-datepicker-wrapper{display:block}.react-datepicker__navigation:focus{outline:0}.wizard-step{min-height:650px}.wizard-step-content{min-height:600px}.list-group-item.active{font-weight:500}.question-category-1{background-color:rgba(8,255,0,.05)}.question-category-2{background-color:rgba(230,127,0,.05)}.question-category-3{background-color:rgba(222,0,230,.05)}.question-category-4{background-color:rgba(0,84,230,.05)}.question-category-5{background-color:rgba(0,230,222,.05)}
.checkbox label {
font-weight: 700;
}
.panel-title .checkbox label {
font-weight: 400;
}
.answerable-question {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
padding: 0 15px;
}
.answerable-subquestions {
padding-top: 10px;
padding-left: 2em;
border: 1px solid #bce8f1;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
margin-bottom: 18px;
}
svg {
fill: currentColor;
}
.caret-square-down,
.caret-square-up,
.info-circle,
.question-circle {
height: 1rem;
margin-bottom: 0.15rem;
}
.caret-square-down,
.caret-square-up {
margin-right: 0.2rem;
}
.help-icon-text-input {
margin-bottom: 25px;
bottom: 0;
}
.has-unit-label {
margin-bottom: 26px;
bottom: 0;
font-weight: 700;
position: absolute;
}
.tooltip-content {
white-space: pre-wrap;
}
.collapse-toggle {
margin-right: 0.3em;
line-height: 0.9;
}
.form-label {
font-weight: 500;
}
input:disabled {
cursor: not-allowed;
}
.cursor-pointer {
cursor: pointer;
}
.accordion > .card {
overflow: visible;
}
.react-datepicker-wrapper {
display: block;
}
.react-datepicker__navigation:focus {
outline: 0;
}
.wizard-step {
min-height: 650px;
}
.wizard-step-content {
min-height: 600px;
}
.list-group-item.active {
font-weight: 500;
}
.question-category-1 {
background-color: rgba(8, 255, 0, 0.05);
}
.question-category-2 {
background-color: rgba(230, 127, 0, 0.05);
}
.question-category-3 {
background-color: rgba(222, 0, 230, 0.05);
}
.question-category-4 {
background-color: rgba(0, 84, 230, 0.05);
}
.question-category-5 {
background-color: rgba(0, 230, 222, 0.05);
}
24 changes: 3 additions & 21 deletions src/components/Answer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,37 +62,19 @@ const Answer = (props) => {

const _renderSelect = (value, label, title) => {
return (
<SelectAnswer
question={props.question}
label={label}
title={title}
value={value}
onChange={onValueChange}
/>
<SelectAnswer question={props.question} label={label} title={title} value={value} onChange={onValueChange} />
);
};

const _renderDateTimePicker = (value, label, title) => {
return (
<DateTimeAnswer
question={props.question}
value={value}
title={title}
label={label}
onChange={onValueChange}
/>
<DateTimeAnswer question={props.question} value={value} title={title} label={label} onChange={onValueChange} />
);
};

const _renderCheckbox = (value, label, title) => {
return (
<CheckboxAnswer
label={label}
title={title}
value={value}
onChange={onValueChange}
question={props.question}
/>
<CheckboxAnswer label={label} title={title} value={value} onChange={onValueChange} question={props.question} />
);
};

Expand Down
14 changes: 2 additions & 12 deletions src/components/DefaultInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,15 @@ export default class DefaultInput extends React.Component {
// TODO change control id to hash of label
return (
<Form.Group size="small" controlId={Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}>
<Form.Check
type="checkbox"
ref={(c) => (this.input = c)}
{...this.props}
label={this.props.label}
/>
<Form.Check type="checkbox" ref={(c) => (this.input = c)} {...this.props} label={this.props.label} />
</Form.Group>
);
}

_renderRadio() {
return (
<FormGroup size="small">
<Form.Check
type="radio"
ref={(c) => (this.input = c)}
{...this.props}
label={this.props.label}
/>
<Form.Check type="radio" ref={(c) => (this.input = c)} {...this.props} label={this.props.label} />
</FormGroup>
);
}
Expand Down
5 changes: 1 addition & 4 deletions src/components/HelpIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ const HelpIcon = (props) => {
return (
<div ref={(el) => getOverlayPlacement(el)}>
<OverlayTrigger placement={props.overlayPlacement || overlayPlacement} overlay={tooltip}>
<span
className={props.iconClassContainer}
style={{ position: props.absolutePosition ? 'absolute' : null }}
>
<span className={props.iconClassContainer} style={{ position: props.absolutePosition ? 'absolute' : null }}>
<QuestionCircle className={props.iconClass} />
</span>
</OverlayTrigger>
Expand Down
10 changes: 2 additions & 8 deletions src/components/MediaContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import Constants from '../constants/Constants';

export default class MediaContent extends React.Component {
render() {
const mediaContent = JsonLdUtils.getJsonAttValue(
this.props.question,
Constants.HAS_MEDIA_CONTENT
);
const mediaContent = JsonLdUtils.getJsonAttValue(this.props.question, Constants.HAS_MEDIA_CONTENT);
if (!mediaContent) {
return null;
}
Expand All @@ -20,10 +17,7 @@ export default class MediaContent extends React.Component {
return (
<div className="col-6">
{mediaContent.map((src) => (
<div
key={'media-' + src}
className="row embed-responsive-21by9 media-content-video-container mb-3"
>
<div key={'media-' + src} className="row embed-responsive-21by9 media-content-video-container mb-3">
{MediaContent.iframe(src)}
</div>
))}
Expand Down
5 changes: 1 addition & 4 deletions src/components/PrefixIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ class PrefixIcon extends React.Component {

return (
<OverlayTrigger trigger="click" placement="right" overlay={p}>
<span
className={this.props.iconClass}
onClick={() => this.setState({ show: !this.state.show })}
>
<span className={this.props.iconClass} onClick={() => this.setState({ show: !this.state.show })}>
{this.props.children}
</span>
</OverlayTrigger>
Expand Down

0 comments on commit 3e02e89

Please sign in to comment.