Skip to content

Commit

Permalink
events working on document scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanquera committed Jun 6, 2024
1 parent 242f64b commit 04bcd44
Show file tree
Hide file tree
Showing 12 changed files with 809 additions and 37 deletions.
122 changes: 101 additions & 21 deletions packages/temple-web/public/styles/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ a, a:link a:hover, a:active, a:visited {
overflow: hidden;
position: absolute;
right: 0;
top: -60px;
top: 0;
transition: 1s;
}

.panel-head .panel-head {
top: 0;
.with-left .panel-head {
left: 226px;
}

.panel .panel-foot {
Expand All @@ -255,38 +255,26 @@ a, a:link a:hover, a:active, a:visited {
transition: 1s;
}

.panel-foot .panel-foot {
bottom: -60px;
}

.panel .panel-left {
bottom: 0;
left: -226px;
left: 0;
overflow: hidden;
position: absolute;
top: 0;
transition: 1s;
width: 226px;
}

.panel-left .panel-left {
left: 0;
}

.panel .panel-right {
bottom: 0;
overflow: hidden;
position: absolute;
right: -226px;
right: 0;
top: 0;
transition: 1s;
width: 226px;
}

.panel-right .panel-right {
right: 0;
}

.panel .panel-main {
bottom: 0;
left: 0;
Expand All @@ -304,22 +292,39 @@ a, a:link a:hover, a:active, a:visited {
width: 100%;
}

.panel-head .panel-main {
.with-head .panel-main {
top: 60px;
}

.panel-foot .panel-main {
.with-foot .panel-main {
bottom: 60px;
}

.panel-left .panel-main {
.with-left .panel-main {
left: 226px;
}

.panel-right .panel-main {
.with-right .panel-main {
right: 226px;
}

@media (max-width: 767px) {
.panel .panel-left {
left: -226px;
}
.panel-left-open .panel-left {
left: 0;
}
.with-left .panel-head,
.with-left .panel-main {
left: 0;
}
.panel-left-open .panel-head,
.panel-left-open .panel-main {
left: 226px;
}
}

/* Head
---------------------------------*/
.head {
Expand All @@ -328,6 +333,11 @@ a, a:link a:hover, a:active, a:visited {
display: flex;
padding: 0 20px;
}
.head .menu {
cursor: pointer;
display: none;
padding: 10px 10px 10px 0;
}
.head img {
height: 26px;
margin-right: 10px;
Expand All @@ -336,6 +346,12 @@ a, a:link a:hover, a:active, a:visited {
flex-grow: 1;
text-transform: uppercase;
}
.with-left .head img {
display: none;
}
.with-left .head h3 {
opacity: 0;
}
.head nav {
align-items: center;
display: flex;
Expand All @@ -362,4 +378,68 @@ a, a:link a:hover, a:active, a:visited {
margin-left: 5px;
padding: 5px;
text-align: center;
}

@media (max-width: 767px) {
.with-left .head .menu {
display: block;
}
}

/* Left
---------------------------------*/
.left {
display: flex;
flex-direction: column;
}
.left header {
align-items: center;
background-color: var(--bg-second);
display: flex;
padding: 17px 5px 17px 10px;
}
.left header img {
height: 26px;
margin-right: 10px;
}
.left header h3 {
flex-grow: 1;
text-transform: uppercase;
}
.left header .toggle {
cursor: pointer;
display: none;
}

.left nav {
flex-grow: 1;
background-color: #151515;
overflow: auto;
padding-bottom: 100px;
}

.left nav h6 {
border-top: 1px solid #121212;
color: #999999;
font-size: 14px;
margin-top: 20px;
padding: 20px 0 10px 10px;
text-transform: uppercase;
}

.left nav h6:first-child {
border-top: none;
margin-top: 0;
}

.left nav a {
color: #EFEFEF;
display: block;
padding: 10px 0 10px 10px;
}

@media (max-width: 767px) {
.left header .toggle {
display: block;
}
}
18 changes: 18 additions & 0 deletions packages/temple-web/src/components/code-preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" />
<style>
:host {
display: block;
}
.preview {
background-color: #EFEFEF;
color: #222222;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
padding: 10px;
}
</style>
<script>
import { props } from '@ossph/temple';
const { children } = props();
</script>
<div class="preview">{children}</div>
81 changes: 80 additions & 1 deletion packages/temple-web/src/components/code-snippet.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,85 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" />
<style>
:host {
display: block;
font-size: 16px;
line-height: 26px;
}
.snippet {
background-color: #101113;
color: #ABB2BF;
margin: 0;
padding: 0;
}

.snippet table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
.snippet .hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
background-color: #040404;
border-bottom: 0;
border-left: 0;
border-right: 2px solid #000000;
border-spacing: 0;
border-top: 0;
color: #CCCCCC;
padding: 3px 10px;
text-align: center;
user-select: none;
vertical-align: top;
}
.snippet .hljs-ln-n:before {
content: attr(data-line-number);
}
.snippet .hljs-ln-code {
padding-left: 10px;
width: 100%;
}
.snippet .hljs-punctuation,
.snippet .hljs-tag {
color: #A0A0A0;
}
.snippet .hljs-tag .hljs-attr,
.snippet .hljs-tag .hljs-name {
color: #476482;
}
.snippet .hljs-keyword,
.snippet .hljs-attribute {
color: #6596CB;
}
.snippet .hljs-selector-tag {
color: #D7BA7D;
}
.snippet .hljs-deletion,
.snippet .hljs-number,
.snippet .hljs-quote,
.snippet .hljs-selector-class,
.snippet .hljs-selector-id,
.snippet .hljs-string,
.snippet .hljs-template-tag,
.snippet .hljs-type {
color: #C3937B;
}
</style>
<script>
import { props } from '@ossph/temple';
const { lang = 'html', children } = props();
const language = `language-${lang}`;

const highlight = event => {
const code = hljs.highlight(
children[0].textContent,
{ language: lang }
).value;
event.detail.target.innerHTML = code;
hljs.lineNumbersBlock(event.detail.target);
};
</script>
<pre><code class=language>{children}</code></pre>
<pre class="snippet"><code class=language mount=highlight></code></pre>
53 changes: 53 additions & 0 deletions packages/temple-web/src/components/tweet-box.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<style>
a, a:link, a:hover, a:active, a:visited {
color: var(--fg-primary);
text-decoration: none;
}
:host {
display: block;
}
.tweet-box {
background-color: #131313;
border: 1px solid #000000;
border-radius: 5px;
display: flex;
margin: 10px;
padding: 20px;
}
.tweet-box .avatar {
margin-right: 20px;
}
.tweet-box .avatar img {
border-radius: 50%;
width: 60px;
}
.tweet-box .content {
flex: 1;
}
.tweet-box .content h3 {
font-size: 16px;
margin: 0;
}
.tweet-box .content a {
font-size: 12px;
}

.tweet-box .content .message {
font-size: 14px;
line-height: 24px;
}
</style>
<script>
import { props } from '@ossph/temple';
const { name, handle, href, src, children } = props();
</script>
<main class="tweet-box">
<aside class="avatar">
<img src={src} alt={handle} />
</aside>
<section class="content">
<h3>{name}</h3>
<a {href} target="_blank">{handle}</a>
<div class="message">{children}</div>
</section>
</main>
Loading

0 comments on commit 04bcd44

Please sign in to comment.