NavMenu / SimpleMenu; SM in GridItem options
This commit is contained in:
parent
251b1e7501
commit
defb9bd34b
8 changed files with 66 additions and 44 deletions
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
import Article from './Article.astro';
|
import Article from './Article.astro';
|
||||||
|
import SimpleMenu from '../layouts/SimpleMenu.astro';
|
||||||
import MenuItem from './MenuItem.astro';
|
import MenuItem from './MenuItem.astro';
|
||||||
|
|
||||||
import postRenderer from '../post-renderer.mjs';
|
import postRenderer from '../post-renderer.mjs';
|
||||||
|
@ -27,7 +28,7 @@ const link = `/blog/${post.slug}`;
|
||||||
image={image}
|
image={image}
|
||||||
preview={true}
|
preview={true}
|
||||||
/>
|
/>
|
||||||
<ul>
|
<SimpleMenu jcc="end">
|
||||||
<MenuItem
|
<MenuItem
|
||||||
name={/*Comments*/""}
|
name={/*Comments*/""}
|
||||||
link={`/blog/comments#${post.slug}`}
|
link={`/blog/comments#${post.slug}`}
|
||||||
|
@ -61,23 +62,13 @@ const link = `/blog/${post.slug}`;
|
||||||
icon=""
|
icon=""
|
||||||
atLeft={false}
|
atLeft={false}
|
||||||
/>
|
/>
|
||||||
</ul>
|
</SimpleMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.card {
|
.card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: end;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
import SimpleMenu from '../layouts/SimpleMenu.astro';
|
||||||
import Icon from './Icon.astro';
|
import Icon from './Icon.astro';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -47,7 +48,9 @@ const {
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="gi-options">
|
<div class="gi-options">
|
||||||
<slot name="options" />
|
<SimpleMenu jcc="center">
|
||||||
|
<slot name="options" />
|
||||||
|
</SimpleMenu>
|
||||||
</div>
|
</div>
|
||||||
<div class="gi-options gi-note">
|
<div class="gi-options gi-note">
|
||||||
<slot name="note" />
|
<slot name="note" />
|
||||||
|
@ -76,18 +79,7 @@ const {
|
||||||
&:target {
|
&:target {
|
||||||
background: var(--accent-bg);
|
background: var(--accent-bg);
|
||||||
|
|
||||||
.gi-options {
|
.gi-options { display: block }
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
:global(.icon) {
|
|
||||||
@icon-size: 1.75rem;
|
|
||||||
|
|
||||||
font-size: @icon-size;
|
|
||||||
width: @icon-size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.gi-btn-close { display: flex }
|
.gi-btn-close { display: flex }
|
||||||
.gi-btn-expand { display: none }
|
.gi-btn-expand { display: none }
|
||||||
|
|
|
@ -5,27 +5,35 @@ export interface Props {
|
||||||
name: string;
|
name: string;
|
||||||
link: string;
|
link: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
tblank?: boolean;
|
||||||
atLeft?: boolean;
|
atLeft?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
datajs?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, link, icon, atLeft = true } = Astro.props;
|
const {
|
||||||
|
name, link, icon,
|
||||||
|
tblank = false,
|
||||||
|
atLeft = true,
|
||||||
|
classes = [],
|
||||||
|
datajs = "",
|
||||||
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<slot name="js-dataset"></slot>
|
<slot name="js-dataset"></slot>
|
||||||
<a href={link}>
|
<a href={link} target={tblank ? "_blank" : "_self"} class:list={classes} data-js={datajs}>
|
||||||
{!atLeft ? name : ""}
|
|
||||||
<span class="icon-wrapper">
|
<span class="icon-wrapper">
|
||||||
<Icon code={icon} />
|
<Icon code={icon} />
|
||||||
</span>
|
</span>
|
||||||
{atLeft ? name : ""}
|
{name}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less" define:vars={{fxd: atLeft ? "row" : "row-reverse"}}>
|
||||||
a {
|
a {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: var(--fxd);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
font-size: 1.15rem;
|
font-size: 1.15rem;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
import GridItem from './GridItem.astro';
|
import GridItem from './GridItem.astro';
|
||||||
import Icon from './Icon.astro';
|
import Icon from './Icon.astro';
|
||||||
|
import MenuItem from './MenuItem.astro';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
app: string;
|
app: string;
|
||||||
|
@ -25,12 +26,19 @@ const {
|
||||||
>
|
>
|
||||||
<Icon code={icon} slot="icon-primary" />
|
<Icon code={icon} slot="icon-primary" />
|
||||||
<Fragment slot="options">
|
<Fragment slot="options">
|
||||||
<a href="javascript:void(0)" class="profile-copy" data-url={copyName ? name : url}>
|
<MenuItem
|
||||||
<Icon code="" />
|
name=""
|
||||||
</a>
|
link="javascript:void(0)"
|
||||||
<a href={url}>
|
icon=""
|
||||||
<Icon code="" />
|
classes={["profile-copy"]}
|
||||||
</a>
|
datajs={copyName ? name : url}
|
||||||
|
/>
|
||||||
|
<MenuItem
|
||||||
|
name="Open"
|
||||||
|
link={url}
|
||||||
|
icon=""
|
||||||
|
tblank
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
|
|
||||||
|
@ -38,7 +46,7 @@ const {
|
||||||
const copy = document.querySelectorAll('.profile-copy')
|
const copy = document.querySelectorAll('.profile-copy')
|
||||||
const copyClickHandler = (ev: Event) => {
|
const copyClickHandler = (ev: Event) => {
|
||||||
const elem = ev.currentTarget as HTMLElement
|
const elem = ev.currentTarget as HTMLElement
|
||||||
const link = elem.dataset.url
|
const link = elem.dataset.js
|
||||||
if (!link) return
|
if (!link) return
|
||||||
navigator.clipboard.writeText(link)
|
navigator.clipboard.writeText(link)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import Layout from "./Layout.astro";
|
import Layout from "./Layout.astro";
|
||||||
import Menu from "./Menu.astro";
|
import NavMenu from "./NavMenu.astro";
|
||||||
import MenuItem from "../components/MenuItem.astro";
|
import MenuItem from "../components/MenuItem.astro";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -14,7 +14,7 @@ const { title, description, article = false } = Astro.props;
|
||||||
|
|
||||||
<Layout title={"Blog | " + title} description={description}>
|
<Layout title={"Blog | " + title} description={description}>
|
||||||
<slot name="metadata" slot="metadata" />
|
<slot name="metadata" slot="metadata" />
|
||||||
<Menu>
|
<NavMenu>
|
||||||
{
|
{
|
||||||
!article ?
|
!article ?
|
||||||
<MenuItem name="Home" icon="" link="/" />
|
<MenuItem name="Home" icon="" link="/" />
|
||||||
|
@ -24,7 +24,7 @@ const { title, description, article = false } = Astro.props;
|
||||||
<MenuItem name="Shorts" icon="" link="/blog/shorts" />
|
<MenuItem name="Shorts" icon="" link="/blog/shorts" />
|
||||||
<MenuItem name="Random" icon="" link="/blog/random" />
|
<MenuItem name="Random" icon="" link="/blog/random" />
|
||||||
<MenuItem name="Search" icon="" link="/blog/search" />
|
<MenuItem name="Search" icon="" link="/blog/search" />
|
||||||
</Menu>
|
</NavMenu>
|
||||||
<main>
|
<main>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import Layout from "./Layout.astro";
|
import Layout from "./Layout.astro";
|
||||||
import Menu from "./Menu.astro";
|
import NavMenu from "./NavMenu.astro";
|
||||||
import MenuItem from "../components/MenuItem.astro";
|
import MenuItem from "../components/MenuItem.astro";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -12,12 +12,12 @@ const { page, description } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title={"DarkCat09 | " + page} description={description}>
|
<Layout title={"DarkCat09 | " + page} description={description}>
|
||||||
<Menu>
|
<NavMenu>
|
||||||
<MenuItem name="Homepage" icon="" link="/" />
|
<MenuItem name="Homepage" icon="" link="/" />
|
||||||
<MenuItem name="Projects" icon="" link="/projects" />
|
<MenuItem name="Projects" icon="" link="/projects" />
|
||||||
<MenuItem name="Services" icon="" link="/services" />
|
<MenuItem name="Services" icon="" link="/services" />
|
||||||
<MenuItem name="Blog" icon="" link="/blog" />
|
<MenuItem name="Blog" icon="" link="/blog" />
|
||||||
</Menu>
|
</NavMenu>
|
||||||
<main>
|
<main>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|
23
src/layouts/SimpleMenu.astro
Normal file
23
src/layouts/SimpleMenu.astro
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
export interface Props {
|
||||||
|
jcc: "start" | "center" | "end" | "space-around" | "space-between";
|
||||||
|
}
|
||||||
|
|
||||||
|
const { jcc } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<slot />
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<style lang="less" define:vars={{jcc: jcc}}>
|
||||||
|
ul {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: var(--jcc);
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Add table
Reference in a new issue