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

[Numeric Input] Update UI of editor #2015

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7396d11
Add headings for "Common Settings" and "Answers" sections.
Dec 4, 2024
b88706d
Individual answers moved to their own accordion.
Dec 5, 2024
c8ac23e
Move delete button to bottom of individual answer panel.
Dec 5, 2024
4af63e0
Move settings labels to individual answer sections.
Dec 5, 2024
d25188a
Update unit tests to account for Unique IDs in WB Accordion.
Dec 5, 2024
3a03430
Changeset
Dec 5, 2024
c7d6c6c
Merge branch 'main' into LEMS-2455-update-layout-editor-for-numeric-i…
Dec 5, 2024
b7abe6e
Remove TS comment (no good way to resolve).
Dec 5, 2024
17bad82
Adjust for Typescript issue.
Dec 5, 2024
c507630
Merge branch 'main' into LEMS-2455-update-layout-editor-for-numeric-i…
Dec 5, 2024
e363ae7
Remove toggle button for additional answer options, and always show t…
Dec 6, 2024
1724cf4
Remove unused objects from code.
Dec 6, 2024
8d605d2
Prettier
Dec 6, 2024
9531c07
Merge branch 'main' into LEMS-2455-update-layout-editor-for-numeric-i…
Dec 9, 2024
3967f9f
Convert general setting options to use WB Pill components.
Dec 10, 2024
accfafb
Correct assignment of new state when toggling heading accordion.
Dec 10, 2024
79535e8
Additional UI changes (better font size, wording, WB Pill, etc.)
Dec 11, 2024
68baa71
Additional UI changes (answer format options).
Dec 12, 2024
1bd7f22
Debugging.
Dec 14, 2024
5c62fb0
Remove debugging.
Dec 14, 2024
1b2674d
Add animation to accordion panels.
Dec 14, 2024
f4eeaea
Change option labels to fieldset/legend to improve accessibility and …
Dec 16, 2024
231d5c2
Changeset
Dec 16, 2024
cf29162
Merge branch 'main' into LEMS-2455-update-layout-editor-for-numeric-i…
Dec 16, 2024
817388f
Merge changes from main branch.
Dec 16, 2024
9ae56f5
Prettier.
Dec 16, 2024
4ec4756
Adjust for type checking.
Dec 16, 2024
b3c8124
Make answer heading show fractions and pi when the format indicates t…
Dec 16, 2024
eb19647
Update latest from main branch.
Jan 9, 2025
884693f
Update from main.
Jan 18, 2025
85c007a
Merge branch 'main' into LEMS-2456-use-wonder-blocks-for-editor-ui
Jan 21, 2025
c593ccc
Address PR comments.
Jan 21, 2025
c13560d
Prettier
Jan 22, 2025
363ecf8
Resolve TypeScript error
Jan 22, 2025
8f78ddf
Resolve TypeScript error
Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/flat-peaches-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": minor
---

[Numeric Input] Re-organize editor and improve its UI
5 changes: 5 additions & 0 deletions .changeset/nice-turkeys-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": minor
---

[Numeric Input] - Adjust editor to organize settings more logically
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@khanacademy/mathjax-renderer": "^2.1.1",
"@khanacademy/wonder-blocks-button": "7.0.5",
"@khanacademy/wonder-blocks-layout": "3.0.5",
"@khanacademy/wonder-blocks-pill": "3.0.5",
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
"@popperjs/core": "^2.10.2",
"@rollup/plugin-alias": "^3.1.9",
Expand Down
1 change: 1 addition & 0 deletions packages/perseus-editor/src/components/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const styles = StyleSheet.create({
marginInline: -10,
backgroundColor: color.offBlack8,
padding: spacing.xSmall_8,
width: "calc(100% + 20px)",
},
heading: {
flexDirection: "row",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as React from "react";
import type {StyleType} from "@khanacademy/wonder-blocks-core";

type Props = {
animated?: boolean;
children: React.ReactNode | React.ReactNode[];
header: string | React.ReactElement;
expanded?: boolean;
Expand All @@ -16,8 +17,15 @@ type Props = {
};

const PerseusEditorAccordion = (props: Props) => {
const {children, header, expanded, containerStyle, panelStyle, onToggle} =
props;
const {
animated,
children,
header,
expanded,
containerStyle,
panelStyle,
onToggle,
} = props;

return (
<View
Expand All @@ -27,6 +35,7 @@ const PerseusEditorAccordion = (props: Props) => {
className="perseus-editor-accordion"
>
<AccordionSection
animated={animated}
expanded={expanded}
onToggle={onToggle}
style={[styles.container, containerStyle]}
Expand Down
151 changes: 111 additions & 40 deletions packages/perseus-editor/src/styles/perseus-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,33 @@
&.leave {
display: none;
}

.inline-options {
float: inline-start; /* flexbox and inline-block don't work on <legend> elements, so going old-school here */
line-height: 24px; /* for alignment with items in same line (like pills or buttons) */
padding-inline-end: 0.5em;
Copy link
Contributor

@SonicScrewdriver SonicScrewdriver Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these comments, thank you very much! It really helps with preventing regressions in the future imo.

}

.tooltip-for-legend {
display: inline-block;
line-height: 24px;
}
}

// Are any widgets capable of overflowing in the editor interface?
.categorizer-container {
overflow-x: scroll;
}

.section-accordion {
display: flex;
flex-direction: row;
}

.delete-item-button {
align-self: center;
padding-right: 0.5em;
}
}

.perseus-widget-editor-title-id > svg {
Expand All @@ -232,6 +253,33 @@
margin-right: 10px;
}

.perseus-editor-accordion-container {
display: inline-grid;
width: 100%;

&.collapsed {
grid-template-rows: 0fr;
min-height: 0;
visibility: hidden;
transition:
all 0.25s step-end,
grid-template-rows 0.25s;
}

&.expanded {
grid-template-rows: 1fr;
min-height: 100%;
visibility: visible;
transition: grid-template-rows 0.5s;
}

.perseus-editor-accordion-content {
overflow: hidden;
margin: 0 -1px; /* allows focus ring on accordion to show */
padding: 0 1px;
}
}

.perseus-editor-widgets-selectors {
background-color: @grayExtraLight;
border: 1px solid @grayLighter;
Expand Down Expand Up @@ -538,25 +586,27 @@
// Input Number / Text Input
//
.perseus-input-number-editor {
font-size: 14px;

.ui-title,
.msg-title {
display: inline-block;
text-align: center;
}

.ui-title {
width: 100px;
}

.msg-title {
margin-left: 5px;
width: 230px;
font-family: Lato, "Noto Sans", sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 20px;

.answer-option {
.unsimplified-options {
min-height: 48px;
}
}

.options-container {
padding-left: 30px;
.perseus-textarea-pair {
font-size: 16px;
.perseus-textarea-underlay {
margin-bottom: 26px;
}
textarea {
background-color: #ffffff;
border: 1px solid rgba(33, 36, 44, 0.5);
border-radius: 4px;
}
}

.input-answer-editor-value,
Expand All @@ -565,38 +615,59 @@
}

.input-answer-editor-value-container {
border: @widgetBorder;
border-radius: @widgetBorderRadius;
float: left;
.size(100px, 53px);
overflow: hidden;
position: relative;
display: block;

input {
background: #ffffff;
border: 1px solid rgba(33, 36, 44, 0.5);
border-radius: 4px;
color: #21242c;
font-family: Lato, "Noto Sans", sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 20px;
outline-offset: -2px;
}

.numeric-input-value {
border: 0;
font-size: 13px;
outline-offset: -3px;
width: 100%;
margin-left: 8px;
width: 6em;
}

.max-error-input-value {
display: none;
width: 3em;
}

.max-error-plusmn {
cursor: default;
display: none;
height: 32px;
padding-top: 4px;
text-align: center;
vertical-align: top;
width: 1em;
}

&.with-max-error {
&.with-max-error,
&:focus-within {
.numeric-input-value {
width: 60%;
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}

.max-error-container {
display: inline-block;
width: 40%;
.max-error-plusmn {
cursor: default;
.max-error-input-value {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
display: inline-block;
width: 20%;
}
.number-input {
border: 0;
font-size: 13px;
width: 80%;

.max-error-plusmn {
border-top: 1px solid rgba(33, 36, 44, 0.5);
border-bottom: 1px solid rgba(33, 36, 44, 0.5);
display: inline-block;
}
}
}
Expand Down
Loading
Loading