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