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

Add slide parts (and mark private methods) #11

Merged
merged 20 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ until we achieve a stable v1.0 release

## v0.1.2 - unreleased

- 🚀 NEW: Add support for slide parts – `slide-canvas` & `slide-note`
(these parts require light DOM styles)
- 🚀 NEW: Slide parts can be hidden
with the `hide-parts="note | canvas"` attribute
(both parts cannot be hidden at the same time)
- 🚀 NEW: Add support for `hide-part="note | canvas"` buttons
to toggle hiding the notes and canvass
- 💥 BREAKING: Removed the shadow DOM content wrapper,
and all shadow DOM styles
- 💥 BREAKING: Renamed and added control-panel parts,
Expand Down
48 changes: 46 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,56 @@ <h2>Open Source</h2>
<a href="https://github.com/oddbird/slide-deck/">github.com/oddbird/slide-deck/</a>
</p>
</div>

<div>
<div slide-canvas>
<h2>Speaker Notes</h2>
<pre><code>&lt;div&gt;
&lt;div slide-canvas&gt;
This slide has both a canvas
&lt;/div&gt;
&lt;div slide-note&gt;
And a section for notes
&lt;/div&gt;
&lt;/div&gt;</code></pre>
</div>
<div slide-note>
<p>
Within a slide element,
we can provide both a 'canvas' and a 'note'!
For styling purposes:
</p>
<ul>
<li>
A slide without nested parts
will be labeled
with the <code>slide-canvas</code> attribute
</li>
<li>
A slide with internal parts
will be labeled
as a <code>slide-container</code> instead
</li>
</ul>
</div>
</div>
<div>
<div slide-canvas>
<h3>Hiding parts</h3>
<button hide-part="note">hide notes</button>
<button hide-part="canvas">hide canvas</button>
</div>
<div slide-note>
<p>
These parts can be shown or hidden separately,
but you can never hide both at once.
</p>
</div>
</div>
<div><h2>To Do…</h2></div>
<div><h3>… Speaker Notes</h3></div>
<div><h3>… Slide Templates</h3></div>
<div><h3>… CSS Themes</h3></div>
<div><h3>… More Better Good Stuff</h3></div>
</slide-deck>

</body>
</html>
23 changes: 19 additions & 4 deletions slide-deck.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
slide-deck {
--color-dark: #1e1e1e;
--color-light: white;
--gap: clamp(8px, 0.25em + 1vw, 16px);
color: var(--text-color);
container: slide-deck / inline-size;
display: grid;
min-height: 100vh;

&[slide-view=grid] {
--slide-ratio: 16/9;
Expand All @@ -18,16 +22,23 @@ slide-deck {

&[blank-slide]::after {
content: '';
background-color: var(--blank-color, black);
background-color: var(--blank-color);
position: absolute;
inset: 0;
z-index: -1;
}

&[blank-slide=black] {
--blank-color: var(--color-dark);
--text-color: var(--color-light);
}

&[blank-slide=white] {
--blank-color: white;
--blank-color: var(--color-light);
--text-color: var(--color-dark);
Copy link
Member Author

Choose a reason for hiding this comment

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

@stacy I think the purpose of the blank slide is hiding what's on the screen - it's a way to temporarily 'pause' the presentation, either with a white or black overlay. Moving the overlay behind the text, and then adding text contrast kinda defeats the purpose, right?

Copy link
Member

Choose a reason for hiding this comment

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

@mirisuzanne that was not clear to me at all, and for some reason the "blank" in the name made me think it was more like we are starting with a blank slate, a default slide instead of the more obvious intention of "this should not show anything and it should be blank or empty" 🤦🏻‍♀️ . I don't really know what design issues need to be solved in which PRs/Issues right now, and what is a bug vs what isn't yet ready so I feel like I am overthinking things and not being very helpful yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I think right now the biggest design issues are the comment above (UX questions about how this should work - what views should be available) and actually designing the slide templates over on the workshop repo. It's ok for design to be pretty minimal in this repo for now.

}

[id^=slide_] {
[slide-canvas] {
aspect-ratio: var(--slide-ratio);
border: thin solid;
box-sizing: border-box;
Expand All @@ -42,6 +53,10 @@ slide-deck {
}
}

[slide-note] {
margin-block: var(--gap);
}

&::part(control-panel) {
min-width: min(50ch, 100%);
padding: 0;
Expand All @@ -67,7 +82,7 @@ slide-deck {
}

[aria-pressed=true],
&::part(button pressed) {
&::part(pressed) {
border-color: currentColor;
}
}
Loading