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

Two column support in Perseus #766

Closed
wants to merge 7 commits into from
Closed

Two column support in Perseus #766

wants to merge 7 commits into from

Conversation

daniellewhyte
Copy link
Contributor

@daniellewhyte daniellewhyte commented Oct 16, 2023

Summary

The Mastery-enabled Long Passage Practice project will introduce a two column layout for certain exercises, specifically long passages that have 4-5 questions associated with them. The user will see two columns with the passage on the left side and the questions on the right side.

To achieve this new UI, this PR introduces an update to the ServerItemRenderer to add renderColumn to the apiOptions, so that ExerciseChrome in the content library can control how to display each column.

Issue: CL-1121

Test plan:

Storybook:
http://localhost:6006/?path=/story/perseus-renderers-server-item-renderer--sat-passage-item-left-column
Screen Shot 2023-10-16 at 5 14 04 PM
http://localhost:6006/?path=/story/perseus-renderers-server-item-renderer--sat-passage-item-right-column
Screen Shot 2023-10-16 at 5 14 15 PM

aag and others added 6 commits July 5, 2023 11:48
This commit adds a proof of concept for allowing Perseus to render only
a single column when the content contains two columns. The idea is that
the containing page would render two separate `ServerItemRenderer`
components, one for each column. It could then control how each column
is laid out.

Example code:

```
<div class="column-wrapper">
    <div class="left-column">
        <ServerItemRenderer
            item={item}
            apiOptions={{renderColumn: "left"}} />
    </div>
    <div class="right-column">
        <ServerItemRenderer
            item={item}
            apiOptions={{renderColumn: "right"}} />
    </div>
</div>
```
If the question has hints, we don't want them to appear with the passage
in the left column. This commit excludes hints if the calling code
specifies that only the left column should be rendered.
@daniellewhyte daniellewhyte self-assigned this Oct 16, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2023

Size Change: +76 B (0%)

Total Size: 852 kB

Filename Size Change
packages/perseus/dist/es/index.js 398 kB +76 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.1 kB
packages/kmath/dist/es/index.js 4.25 kB
packages/math-input/dist/es/index.js 105 kB
packages/perseus-core/dist/es/index.js 905 B
packages/perseus-editor/dist/es/index.js 268 kB
packages/perseus-error/dist/es/index.js 847 B
packages/perseus-linter/dist/es/index.js 21.4 kB
packages/pure-markdown/dist/es/index.js 3.77 kB
packages/simple-markdown/dist/es/index.js 12.3 kB

compressed-size-action

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #766 (f39697f) into main (77bd12d) will increase coverage by 1.29%.
The diff coverage is 90.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #766      +/-   ##
==========================================
+ Coverage   59.63%   60.92%   +1.29%     
==========================================
  Files         480      482       +2     
  Lines      105413   105447      +34     
  Branches     6031     8714    +2683     
==========================================
+ Hits        62860    64243    +1383     
+ Misses      42553    41204    -1349     

Impacted file tree graph

Files Coverage Δ
packages/perseus/src/renderer.tsx 92.86% <100.00%> (+0.03%) ⬆️
packages/perseus/src/server-item-renderer.tsx 98.30% <100.00%> (+<0.01%) ⬆️
packages/perseus/src/perseus-markdown.tsx 89.05% <50.00%> (-0.58%) ⬇️

... and 43 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77bd12d...f39697f. Read the comment docs.

@daniellewhyte
Copy link
Contributor Author

Closed! Discussed with the Perseus team and we decided on a different solution. Currently implemented in webapp here: https://github.com/Khan/webapp/pull/17851. May be moved into Perseus when grouped assessment items are supported in mobile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants