generated from daviddarnes/component-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from oddbird/controls
Control panel styles and parts
- Loading branch information
Showing
5 changed files
with
183 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" style="color-scheme: light dark"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="description" content="Demo of slide-deck Web Component" /> | ||
<title>Slide-Deck Web Component Demo</title> | ||
<link rel="stylesheet" href="slide-deck.css"> | ||
<style>body { margin: 0; }</style> | ||
<script type="module" src="slide-deck.js"></script> | ||
</head> | ||
<body> | ||
<slide-deck id="my-slides" key-control> | ||
<dialog slot="control-panel"> | ||
<div> | ||
<button set-view>grid</button> | ||
<button set-view>list</button> | ||
<form method="dialog"><button>close</button></form> | ||
</div> | ||
</dialog> | ||
<header> | ||
<h1>Slide-Deck Web Component</h1> | ||
<p> | ||
<a href="https://github.com/oddbird/slide-deck/">github.com/oddbird/slide-deck/</a> | ||
</p> | ||
</header> | ||
<div> | ||
<h2>Custom Control Panel</h2> | ||
<p><strong>command-k</strong> to open</p> | ||
</div> | ||
<div> | ||
<a href="./index.html">Back to demo</a> | ||
</div> | ||
</slide-deck> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
slide-deck { | ||
--gap: clamp(8px, 0.25em + 1vw, 16px); | ||
container: slide-deck / inline-size; | ||
display: grid; | ||
|
||
&[slide-view=grid] { | ||
--slide-ratio: 16/9; | ||
--target-outline: medium dotted; | ||
--target-margin: var(--gap); | ||
gap: var(--gap); | ||
grid-template-columns: repeat(auto-fill, minmax(min(50ch, 100%), 1fr)); | ||
padding: var(--gap); | ||
} | ||
|
||
&[slide-view=list] { | ||
--slide-height: 100svh; | ||
} | ||
|
||
&[blank-slide]::after { | ||
content: ''; | ||
background-color: var(--blank-color, black); | ||
position: absolute; | ||
inset: 0; | ||
} | ||
|
||
&[blank-slide=white] { | ||
--blank-color: white; | ||
} | ||
|
||
[id^=slide_] { | ||
aspect-ratio: var(--slide-ratio); | ||
border: thin solid; | ||
box-sizing: border-box; | ||
container: slide-item / inline-size; | ||
min-height: var(--slide-height); | ||
padding: var(--gap); | ||
scroll-margin-block: var(--target-margin); | ||
|
||
&:target { | ||
outline: var(--target-outline); | ||
outline-offset: calc(var(--gap) * 0.5); | ||
} | ||
} | ||
|
||
&::part(control-panel) { | ||
min-width: min(50ch, 100%); | ||
padding: 0; | ||
} | ||
|
||
&::part(panel-header) { | ||
border-block-end: thin solid; | ||
display: grid; | ||
gap: var(--gap); | ||
grid-template-columns: 1fr auto; | ||
padding: var(--gap); | ||
} | ||
|
||
&::part(controls) { | ||
padding: var(--gap); | ||
} | ||
|
||
button, | ||
&::part(button) { | ||
font: inherit; | ||
padding-inline: var(--gap); | ||
border: medium solid transparent; | ||
} | ||
|
||
[aria-pressed=true], | ||
&::part(button pressed) { | ||
border-color: currentColor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters