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

Interactive SICP-JS: Changes to style and formatting #1800

Merged
merged 4 commits into from
Jun 17, 2021
Merged
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
4 changes: 2 additions & 2 deletions src/features/sicp/SourceTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const SourceThemeBackground = '#2c3e50';
export const SourceTheme = {
'code[class*="language-"]': {
color: 'white',
background: SourceThemeBackground,
background: 'transparent',
fontFamily: "'Inconsolata', 'Consolas', monospace",
textAlign: 'left',
whiteSpace: 'pre',
Expand Down Expand Up @@ -47,7 +47,7 @@ export const SourceTheme = {
borderRadius: '0.3em'
},
':not(pre) > code[class*="language-"]': {
background: SourceThemeBackground,
background: 'transparent',
padding: '0.1em',
borderRadius: '0.3em',
whiteSpace: 'normal'
Expand Down
10 changes: 6 additions & 4 deletions src/pages/sicp/subcomponents/CodeSnippet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Pre } from '@blueprintjs/core';
import { Card, Elevation, Pre } from '@blueprintjs/core';
import { HighlightRulesSelector, ModeSelector } from 'js-slang/dist/editors/ace/modes/source';
import { Resizable } from 're-resizable';
import * as React from 'react';
Expand Down Expand Up @@ -113,9 +113,11 @@ const CodeSnippet: React.FC<CodeSnippetProps> = props => {
)}
</div>
) : (
<SyntaxHighlighter language="javascript" style={SourceTheme} onClick={handleOpen}>
{body}
</SyntaxHighlighter>
<Card className="sicp-code-snippet-closed" interactive={true} elevation={Elevation.TWO}>
<SyntaxHighlighter language="javascript" style={SourceTheme} onClick={handleOpen}>
{body}
</SyntaxHighlighter>
</Card>
)}
{output && <Pre>{output}</Pre>}
</div>
Expand Down
3 changes: 0 additions & 3 deletions src/pages/sicp/subcomponents/SicpIndexPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ const developers = 'Samuel Fang';

const authors = (
<div className="sicp-authors">
<br />
<H4>{originalAuthors}</H4>
<p>
{originalWithAuthors}
<i>— original authors</i>
</p>
<br />
<H4>{adaptedAuthors}</H4>
<p>
{adaptedWithAuthors}
<i>— adapters to JavaScript</i>
</p>
<br />
<H4>{developers}</H4>
<p>
<i>— designer and developer of Interactive SICP</i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

exports[`Sicp Code Snippet renders correctly 1`] = `
"<div className=\\"sicp-code-snippet\\">
<SyntaxHighlighter language=\\"javascript\\" style={{...}} onClick={[Function: handleOpen]}>
1+1;
</SyntaxHighlighter>
<Blueprint3.Card className=\\"sicp-code-snippet-closed\\" interactive={true} elevation={2}>
<SyntaxHighlighter language=\\"javascript\\" style={{...}} onClick={[Function: handleOpen]}>
1+1;
</SyntaxHighlighter>
</Blueprint3.Card>
<Component>
2
</Component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ exports[`Sicp index page 1`] = `
</Component>
</div>
<div className=\\"sicp-authors\\">
<br />
<Component>
<h4 className=\\"bp3-heading\\">
Harold Abelson and Gerald Jay Sussman
Expand All @@ -31,7 +30,6 @@ exports[`Sicp index page 1`] = `
— original authors
</i>
</p>
<br />
<Component>
<h4 className=\\"bp3-heading\\">
Martin Henz and Tobias Wrigstad
Expand All @@ -43,7 +41,6 @@ exports[`Sicp index page 1`] = `
— adapters to JavaScript
</i>
</p>
<br />
<Component>
<h4 className=\\"bp3-heading\\">
Samuel Fang
Expand Down
23 changes: 23 additions & 0 deletions src/styles/_sicp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ $sicp-background-color: #ffffff;
overflow-x: scroll;
}

.bp3-blockquote {
margin: 10px 0;
}

.bp3-heading {
margin-top: 10px;
}
Expand Down Expand Up @@ -69,6 +73,10 @@ $sicp-background-color: #ffffff;
text-align: right;
}

h4 {
margin-top: 15px;
}

> h2,
> .sicp-licenses {
text-align: center;
Expand Down Expand Up @@ -173,6 +181,11 @@ $sicp-background-color: #ffffff;
width: 100vw;
}
}

.sicp-code-snippet-closed {
padding: 0;
margin: 0;
}
}

.sicp-footnote {
Expand Down Expand Up @@ -227,6 +240,16 @@ $sicp-background-color: #ffffff;

.sicp-toc {
overflow-y: auto;
text-align: left;

.bp3-tree-node-caret {
color: #777777 !important;
scale: 1.25;
}

.bp3-tree-node-caret:hover {
color: $sicp-text-color !important;
}
}

.sicp-toc-drawer {
Expand Down