Skip to content

Commit

Permalink
Merge pull request jupyterlab#50 from markellekelly/master
Browse files Browse the repository at this point in the history
Added show/hide cell functionality
  • Loading branch information
markellekelly committed Aug 9, 2018
2 parents 530714a + c931278 commit 9fa2330
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/generators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ function notebookItemRenderer(
6: '10'
};
let jsx;
const hideOnClick = (cell?: Cell) => {
if (cell) {
cell.inputHidden = !cell.inputHidden;
}
};
if (item.type === 'markdown' || item.type === 'header') {
const paddingLeft = 24;
const collapseOnClick = (cellRef?: Cell) => {
Expand Down Expand Up @@ -221,6 +226,14 @@ function notebookItemRenderer(
<div className="toc-entry-holder">
{item.hasChild && twistButton}
{jsx}
<div className={'eyeball-icon'}>
<img
src={require('../static/eyeball_view.svg')}
onClick={event => {
hideOnClick(item.cellRef);
}}
/>
</div>
</div>
);
}
Expand Down Expand Up @@ -271,6 +284,14 @@ function notebookItemRenderer(
<div className="toc-entry-holder">
{item.hasChild && twistButton}
{jsx}
<div className={'eyeball-icon'}>
<img
src={require('../static/eyeball_view.svg')}
onClick={event => {
hideOnClick(item.cellRef);
}}
/>
</div>
</div>
);
}
Expand All @@ -284,6 +305,14 @@ function notebookItemRenderer(
<span className={'toc-code-span'}>
<CodeComponent code={item.text!} theme="jupyter" />
</span>
<div className={'eyeball-icon'}>
<img
src={require('../static/eyeball_view.svg')}
onClick={event => {
hideOnClick(item.cellRef);
}}
/>
</div>
</div>
);
} else if (item.type === 'raw' && options.showRaw) {
Expand All @@ -292,6 +321,14 @@ function notebookItemRenderer(
<span className={'toc-code-span'}>
<CodeComponent code={item.text!} theme="none" />
</span>
<div className={'eyeball-icon'}>
<img
src={require('../static/eyeball_view.svg')}
onClick={event => {
hideOnClick(item.cellRef);
}}
/>
</div>
</div>
);
} else {
Expand Down
3 changes: 3 additions & 0 deletions static/eyeball_hidden.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/eyeball_hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/eyeball_view.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ TOTAL SIZE REMAINS AT 24PX INCLUDING MARGINS AND PADDING */
display: inline-flex;
position: relative;
align-items: center;
width: 100%;
}

.toc-collapse-button {
Expand All @@ -232,6 +233,7 @@ TOTAL SIZE REMAINS AT 24PX INCLUDING MARGINS AND PADDING */
}

.header-cell {
width: 100%;
overflow-x: hidden;
overflow-y: hidden;
}
Expand All @@ -248,3 +250,10 @@ TOTAL SIZE REMAINS AT 24PX INCLUDING MARGINS AND PADDING */
opacity: 0;
overflow: hidden;
}

.eyeball-icon {
float: right;
padding: 0px;
margin: 0px;
padding-left: 7px;
}

0 comments on commit 9fa2330

Please sign in to comment.