Skip to content

Commit

Permalink
Merge branch 'main' into K12-86/dependency-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rnathuji committed Jul 24, 2024
2 parents f9e1541 + 33f4a73 commit 0b0f73e
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 61 deletions.
13 changes: 2 additions & 11 deletions docs/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ If students are entering something into a text block, be sure to follow these co
The output if the `data-wait-for-event="eventnameY"` attribute is removed and the user submits an answer.

<div style="text-align: center;">
<img src="./static/input_block.png" width="450">
<img src="./static/gen-input.png" width="450">
</div>

Notes on schema:
Expand Down Expand Up @@ -226,16 +226,7 @@ Users can attempt to answer questions and check their solution. Retries are allo
The output if the `data-wait-for-event="eventnameZ"` attribute is removed.

<div style="text-align: center;">
<img src="./static/input_problem.png" width="450">
</div>
<div style="text-align: center;">
<img src="./static/dropdown_problem.png" width="450">
</div>
<div style="text-align: center;">
<img src="./static/multichoice_problem.png" width="450">
</div>
<div style="text-align: center;">
<img src="./static/multiselect_problem.png" width="450">
<img src="./static/problem_set_blocks.png" width="450">
</div>


Expand Down
Binary file removed docs/static/dropdown_problem.png
Binary file not shown.
Binary file added docs/static/gen-input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/static/input_block.png
Binary file not shown.
Binary file removed docs/static/input_problem.png
Binary file not shown.
Binary file removed docs/static/multichoice_problem.png
Binary file not shown.
Binary file removed docs/static/multiselect_problem.png
Binary file not shown.
Binary file added docs/static/problem_set_blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/AttemptsCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Props {

export const AttemptsCounter = ({ retryLimit, retriesAllowed }: Props): JSX.Element => {
return (
<div className="os-flex os-justify-content-end">
<div className="os-ml-auto">
<p className="os-attempts-text">
Attempts left: {retryLimit - retriesAllowed + 1}/
{retryLimit + 1}
Expand Down
12 changes: 7 additions & 5 deletions src/components/DropdownProblem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const DropdownProblem = ({
}

return (
<div className="os-raise-bootstrap">
<div className="os-raise-bootstrap mb-4">
<div className="my-3" ref={contentRefCallback} dangerouslySetInnerHTML={{ __html: content }} />
<Formik
initialValues={{ response: '' }}
Expand Down Expand Up @@ -142,18 +142,20 @@ export const DropdownProblem = ({
{generateOptions()}
</Field>
</div>
<ErrorMessage className="text-danger my-3" component="div" name="response" />
<div className="os-text-center mt-4">
<div className="os-error-attempts-container">
<ErrorMessage className="os-error-message" component="div" name="response" />
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</div>
<div className="os-text-center mt-1">
<button
className="os-btn btn-outline-primary"
className="os-submit-button-default-theme"
type="submit"
disabled={isSubmitting || formDisabled}
>
{buttonText}
</button>
</div>
{feedback !== '' ? <div ref={contentRefCallback} dangerouslySetInnerHTML={{ __html: feedback }} className="my-3 os-feedback-message" /> : null }
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed} />
</Form>
)}
</Formik>
Expand Down
12 changes: 7 additions & 5 deletions src/components/InputProblem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const InputProblem = ({
setFeedback('')
}
return (
<div className="os-raise-bootstrap">
<div className="os-raise-bootstrap mb-4">

<div className="my-3" ref={contentRefCallback} dangerouslySetInnerHTML={{ __html: content }} />
<Formik
Expand Down Expand Up @@ -208,11 +208,13 @@ export const InputProblem = ({
)
}
</div>
<ErrorMessage className="text-danger my-3" component="div" name="response" />
<div className="os-text-center mt-4">
<button type="submit" disabled={inputDisabled || isSubmitting} className="os-btn btn-outline-primary">{buttonText}</button></div>
<div className="os-error-attempts-container">
<ErrorMessage className="os-error-message" component="div" name="response" />
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</div>
<div className="os-text-center mt-1">
<button type="submit" disabled={inputDisabled || isSubmitting} className="os-submit-button-default-theme">{buttonText}</button></div>
{feedback !== '' ? <div ref={contentRefCallback} dangerouslySetInnerHTML={{ __html: feedback }} className="my-3 os-feedback-message" /> : null}
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</Form>
)}
</Formik>
Expand Down
16 changes: 7 additions & 9 deletions src/components/MultipleChoiceProblem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const MultipleChoiceProblem = ({
}
}
return (
<div className="os-raise-bootstrap" ref={contentRefCallback}>
<div className="os-raise-bootstrap mb-4" ref={contentRefCallback}>
<div className="my-3" dangerouslySetInnerHTML={{ __html: content }} />
<Formik
initialValues={{ response: '' }}
Expand All @@ -173,14 +173,13 @@ export const MultipleChoiceProblem = ({
<div className="os-grid">
{generateOptions(values, isSubmitting, setFieldValue)}
</div>
<ErrorMessage
className="text-danger my-3"
component="div"
name="response"
/>
<div className="os-text-center mt-4">
<div className="os-error-attempts-container">
<ErrorMessage className="os-error-message" component="div" name="response" />
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</div>
<div className="os-text-center mt-1">
<button
className="os-btn btn-outline-primary"
className="os-submit-button-default-theme"
type="submit"
disabled={isSubmitting || formDisabled}
>
Expand All @@ -196,7 +195,6 @@ export const MultipleChoiceProblem = ({
/>
)
: null}
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</Form>
)}
</Formik>
Expand Down
12 changes: 7 additions & 5 deletions src/components/MultiselectProblem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const MultiselectProblem = ({
}

return (
<div className="os-raise-bootstrap" ref={contentRefCallback}>
<div className="os-raise-bootstrap mb-4" ref={contentRefCallback}>
<div className="my-3" dangerouslySetInnerHTML={{ __html: content }} />
<Formik
initialValues={{ response: [] }}
Expand All @@ -187,10 +187,13 @@ export const MultiselectProblem = ({
{({ isSubmitting, setFieldValue, values }) => (
<Form>
<div className='os-grid'>{generateOptions(values, isSubmitting, setFieldValue)}</div>
<ErrorMessage className="text-danger my-3" component="div" name="response" />
<div className='os-text-center mt-4'>
<div className="os-error-attempts-container">
<ErrorMessage className="os-error-message" component="div" name="response" />
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed}/>
</div>
<div className='os-text-center mt-1'>
<button
className="os-btn btn-outline-primary"
className="os-submit-button-default-theme"
type="submit"
disabled={isSubmitting || formDisabled}
>
Expand All @@ -199,7 +202,6 @@ export const MultiselectProblem = ({
</div>

{feedback !== '' ? <div ref={contentRefCallback} dangerouslySetInnerHTML={{ __html: feedback }} className="my-3 os-feedback-message" /> : null}
<AttemptsCounter retryLimit={retryLimit} retriesAllowed={retriesAllowed} />
</Form>
)}
</Formik>
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserInputBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ export const UserInputBlock = ({ content, prompt, ack, waitForEvent, fireEvent,
disabled={isSubmitting || responseSubmitted}
rows={DEFAULT_TEXTAREA_ROWS}
className={buildClassName(responseSubmitted, errors.response)}/>
<ErrorMessage className="text-danger my-3" component="div" name="response" />
<ErrorMessage className="text-danger my-2" component="div" name="response" />
<div className='os-text-center mt-4'>
<button type="submit" disabled={isSubmitting || responseSubmitted} className="os-btn btn-outline-primary">{buttonText}</button>
<button type="submit" disabled={isSubmitting || responseSubmitted} className="os-submit-button-default-theme">{buttonText}</button>
</div>
</Form>
)}
Expand Down
24 changes: 15 additions & 9 deletions src/styles/bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,20 @@
$os-default-answer-border-color: #424242;
$os-medium-gray: #626262;
$os-default-box-shadow: #808080;
$os-default-gray: #757575;

// Extends Select Element for Dropdown Styles
.os-form-select {
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
@extend .form-select;

border: .125rem solid $os-default-answer-border-color;
border: .063rem solid $os-default-gray;
border-radius: .3125rem;
box-shadow: 0 .125rem .125rem $os-default-box-shadow;
padding: .75rem 2.25rem .75rem .75rem;
box-shadow: 0 .125rem .25rem 0 hsla(0deg 0% 46% / 25%);
padding: 1rem 1.5rem;
cursor: pointer;
background-image: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" viewBox="0 0 22 22"%3E%3Cpath fill="currentColor" d="m7 10l5 5l5-5z"%2F%3E%3C%2Fsvg%3E'), linear-gradient(#f5f5f5, #f5f5f5),;
background-size: 2.5rem 3.125rem;
background-size: 3rem 4.125rem;
background-position: right 0 center;
color: $os-medium-gray;
}
Expand All @@ -171,13 +172,17 @@
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
@extend .form-control;

border: .125rem solid $os-default-answer-border-color;
border: .063rem solid $os-default-gray;
border-radius: .3125rem;
box-shadow: 0 .125rem .125rem $os-default-box-shadow;
box-shadow: 0 .125rem .25rem 0 hsla(0deg 0% 46% / 25%);
}

input.os-form-control {
padding: .75rem;
padding: 1rem 1.5rem;
}

textarea.os-form-control {
padding: 1rem 1.5rem;
}

math-field.os-form-control {
Expand All @@ -197,6 +202,7 @@
@extend .form-check;

padding-left: 0;
margin-bottom: 0;
}

// Extends Checkbox for Multi Select Styles
Expand All @@ -206,7 +212,7 @@

min-width: 1.2em;
min-height: 1.2em;
border: .125rem solid $os-default-answer-border-color;
border: .125rem solid $os-default-gray;
}

// Extends Check Button for All Interactives
Expand Down
41 changes: 27 additions & 14 deletions src/styles/interactives.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
$os-correct-answer-border-color: #019920;
$os-selected-focus-border-color: #159eb2;
$os-wrong-answer-border-color: #fc0516;
$os-default-answer-border-color: #424242;
$os-default-gray: #757575;
$os-dark-gray: #424242;
$os-medium-gray: #626262;
$os-light-gray: #d9d9d9;
$os-answer-background: #f5f5f5;
Expand All @@ -12,13 +13,13 @@ $os-dark-green: #0A5B50;
div.os-grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 2rem;
grid-gap: 1rem;
}

.os-default-answer-choice {
border: .125rem solid $os-default-answer-border-color;
border: .063rem solid $os-default-gray;
border-radius: .3125rem;
box-shadow: 0 .125rem .125rem $os-default-box-shadow;
box-shadow: 0 .125rem .25rem 0 hsla(0deg 0% 46% / 25%);
}

div.os-default-answer-choice:focus-within {
Expand All @@ -27,14 +28,15 @@ div.os-default-answer-choice:focus-within {

div.os-default-answer-choice > div:hover {
background-color: $os-answer-background;
border-radius: .3125rem;
}

label.os-label-container {
display: flex;
align-items: center;
width: 100%;
height: 100%;
padding: .75rem .5rem .75rem .8rem;
padding: 1rem 1.5rem;
cursor: pointer;
}

Expand Down Expand Up @@ -86,7 +88,7 @@ select.os-form-select:hover {
// Input Styles
.os-form-control.os-form-control:focus {
border-color: $os-selected-focus-border-color;
box-shadow: 0 .125rem .125rem $os-default-box-shadow;
box-shadow: 0 .125rem .25rem 0 hsla(0deg 0% 46% / 25%);
}

.os-form-control.os-form-control:disabled {
Expand All @@ -113,20 +115,21 @@ math-field.os-form-control.os-disabled {

div.os-feedback-message {
background-color: $os-light-gray;
padding: .5rem;
padding: 1rem 1.5rem;
border-radius: .3125rem;
}

div.os-feedback-message p {
color: $os-medium-gray;
color: #000;
margin-bottom: 0;
}

p.os-attempts-text {
color: $os-medium-gray;
color: $os-dark-gray;
}

div.os-justify-content-end {
justify-content: end;
div.os-error-message {
color: #C22032;
}

.os-disabled.os-disabled {
Expand All @@ -138,6 +141,16 @@ div.os-justify-content-end {
text-align: center;
}

div.os-error-attempts-container {
display: flex;
justify-content: space-between;
margin-top: .5rem;
}

.os-ml-auto {
margin-left: auto;
}

// All Interactives + CTA Styles
%os-submit-button-base {
border-radius: .5rem;
Expand All @@ -161,11 +174,11 @@ div.os-justify-content-end {
box-shadow: none;
}

.os-submit-button-default-theme {
button.os-submit-button-default-theme {
@extend %os-submit-button-base;

background-color: #757575;
border: 1px solid #757575;
background-color: $os-default-gray;
border: 1px solid $os-default-gray;
box-shadow: 0 .125rem .25rem 0 hsla(0deg 0% 46% / 25%);
}

Expand Down

0 comments on commit 0b0f73e

Please sign in to comment.