Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 2 deletions styles/books/generic/webview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,9 @@
// Notes
@include use('Note', 'webview:::NoteShape');
// Exercises
@include use('Exercise', 'webview:::ExerciseShape');
@include use('InjectedExercise', 'webview:::InjectedExerciseShape');
@include webview.content-injected-shared();
@include webview.content-exercises();
@include webview.injected-exercises();
@include use('ExerciseInAppendix', 'webview:::ExerciseInAppendixShape');
@include use('ExerciseInlined', 'webview:::ExerciseInlined');
@include use('QuestionWithProblemPrefix','webview:::ExercisesQuestionWithProblemPrefixShape');
Expand Down
35 changes: 35 additions & 0 deletions styles/lib/webview/_theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Colors
$black: #000;
$white: #fff;
$gray: #424242;
$gray2: #555;
$gray3: #757575;
$gray5: #5C5C5C;
$grayDark: #333;
$grayMedium: #606163;
$grayLight: #dcdcdc;
$grayLight2: #ddd;
$grayLight3: #f9f2f4;
$grayLightest: #ededed;
$grayLightest2: #ececec;
$lightBlue: #026aa1;
$blue: #005481;
$blue2: #005F9A;
$blue3: #0078a3;
$blue4: #0074BC;
$blue9: #0000aa;
$darkBlue: #21366b;
$darkerBlue: #2e3092;
$red: #c7254e;
$darkRed: #b90000;
$darkRed2: #CC0000;
$green: #156851;
$green2: #007A49;
$green3: #C3E2C3;
$green4: #006900;
$green5: #006464;
$green6: #006767;
$magenta: #E00087;
$purple: #8d4c83;
$yellow: #8F7200;
$brown2: #914700;
3 changes: 3 additions & 0 deletions styles/lib/webview/_webview.scss
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
@forward 'lib/webview/features/exercises';

// Shared with other themes
@forward 'lib/cardboard/features/code-colors';
94 changes: 94 additions & 0 deletions styles/lib/webview/features/_exercises.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
@use 'lib/webview/theme' as webview;

@mixin content-injected-shared() {
// shared content & injected exercise styles
[data-type=exercise] [data-type=problem],
[data-type=injected-exercise] [data-type=exercise-question] {
display: table;
padding: 0.5em 1em;
> .os-number {
display: table-cell;
font-weight: 700;
text-decoration: none;
text-align: right;
width: 30px;
~ .os-problem-container {
display: table-cell;
}
}
> .os-divider {
margin-right: 0.5em;
}
}
}

@mixin content-exercises() {
// just content exercises
[data-type=exercise] {
div[data-type=title] {
font-weight: bold;
}
[data-type=problem] {
a.lo-reference {
margin-right: 0.5em;
font-weight: bold;
}
}
[data-type=solution] {
padding: 0.5em 1em;
border-top-width: 0.1rem;
border-top-color: webview.$grayLight;
border-top-style: solid;
.btn-link {
color: webview.$darkBlue;
font-weight: 400;
border-radius: 0;
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border-color: transparent;
}
> .ui-toggle {
font-weight: bold;
text-align: center;
text-transform: capitalize;
list-style: none;
cursor: pointer;
}
> .ui-toggle::before {
content: "[Show/Hide Solution]";
}
> summary.ui-toggle::-webkit-details-marker {
display: none;
}
}
&.has-problem-title .os-problem-container {
display: initial;
}
&.check-understanding [data-type=title]::before {
margin-right: 0;
content: "";
}
&.conceptual-questions [data-type=problem] {
border-top: none;
p {
margin: 0;
}
}
}
}

@mixin injected-exercises() {
// just injected exercises
[data-type=injected-exercise] [data-type=exercise-question] > .os-problem-container {
> [data-type=question-stem] {
display: table !important;
}
b + img {
vertical-align: top;
}
li[data-type=question-answer] pre {
margin: 0;
}
}
}
110 changes: 13 additions & 97 deletions styles/output/webview-generic.css
Original file line number Diff line number Diff line change
Expand Up @@ -968,47 +968,41 @@ a:hover {
margin-top: 3rem;
}

[data-type=exercise] div[data-type=title] {
font-weight: bold;
}

[data-type=exercise] [data-type=problem] {
[data-type=exercise] [data-type=problem],
[data-type=injected-exercise] [data-type=exercise-question] {
display: table;
padding: 0.5em 1em;
}

[data-type=exercise] [data-type=problem] > .os-number {
[data-type=exercise] [data-type=problem] > .os-number,
[data-type=injected-exercise] [data-type=exercise-question] > .os-number {
display: table-cell;
font-weight: 700;
text-decoration: none;
text-align: right;
width: 30px;
}

[data-type=exercise] [data-type=problem] > .os-divider {
[data-type=exercise] [data-type=problem] > .os-number ~ .os-problem-container,
[data-type=injected-exercise] [data-type=exercise-question] > .os-number ~ .os-problem-container {
display: table-cell;
}
[data-type=exercise] [data-type=problem] > .os-divider,
[data-type=injected-exercise] [data-type=exercise-question] > .os-divider {
margin-right: 0.5em;
}

[data-type=exercise] div[data-type=title] {
font-weight: bold;
}
[data-type=exercise] [data-type=problem] a.lo-reference {
margin-right: 0.5em;
font-weight: bold;
}

[data-type=exercise] [data-type=problem] > .os-number ~ .os-problem-container {
display: table-cell;
}

[data-type=exercise] [data-type=problem] li[data-type=question-answer] pre {
margin: 0;
}

[data-type=exercise] [data-type=solution] {
padding: 0.5em 1em;
border-top-width: 0.1rem;
border-top-color: #dcdcdc;
border-top-style: solid;
}

[data-type=exercise] [data-type=solution] .btn-link {
color: #21366b;
font-weight: 400;
Expand All @@ -1018,117 +1012,39 @@ a:hover {
box-shadow: none;
border-color: transparent;
}

[data-type=exercise] [data-type=solution] > .ui-toggle {
font-weight: bold;
text-align: center;
text-transform: capitalize;
list-style: none;
cursor: pointer;
}

[data-type=exercise] [data-type=solution] > .ui-toggle::before {
content: "[Show/Hide Solution]";
}

[data-type=exercise] [data-type=solution] > summary.ui-toggle::-webkit-details-marker {
display: none;
}

[data-type=exercise] .solution {
padding: 0.5em 1em;
border-top-width: 0.1rem;
border-top-color: #dcdcdc;
border-top-style: solid;
}

[data-type=exercise] .solution .btn-link {
color: #21366b;
font-weight: 400;
border-radius: 0;
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border-color: transparent;
}

[data-type=exercise] .solution > .ui-toggle {
font-weight: bold;
text-align: center;
text-transform: capitalize;
list-style: none;
cursor: pointer;
}

[data-type=exercise] .solution > .ui-toggle::before {
content: "[Show/Hide Solution]";
}

[data-type=exercise] .solution > summary.ui-toggle::-webkit-details-marker {
display: none;
}

[data-type=exercise].has-problem-title .os-problem-container {
display: initial;
}

[data-type=exercise].check-understanding [data-type=title]::before {
margin-right: 0;
content: "";
}

[data-type=exercise].check-understanding .title::before {
margin-right: 0;
content: "";
}

[data-type=exercise].conceptual-questions [data-type=problem] {
border-top: none;
}

[data-type=exercise].conceptual-questions [data-type=problem] p {
margin: 0;
}

[data-type=exercise].conceptual-questions .problem {
border-top: none;
}

[data-type=exercise].conceptual-questions .problem p {
margin: 0;
}

[data-type=injected-exercise] [data-type=exercise-question] {
padding: 0.5em 1em;
display: table;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-number {
display: table-cell;
font-weight: 700;
text-decoration: none;
text-align: right;
width: 30px;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-divider {
margin-right: 0.5em;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-number ~ .os-problem-container {
display: table-cell;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-problem-container > [data-type=question-stem] {
display: table !important;
width: 100%;
table-layout: fixed;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-problem-container b + img {
vertical-align: top;
}

[data-type=injected-exercise] [data-type=exercise-question] > .os-problem-container li[data-type=question-answer] pre {
margin: 0;
}
Expand Down