Skip to content

Commit 3986c4e

Browse files
committed
revise: multiple revisions to the website
1 parent e3b5eea commit 3986c4e

File tree

6 files changed

+214
-130
lines changed

6 files changed

+214
-130
lines changed

Diff for: components/FrontPageCard.vue

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ let cardClicked = () => {
5555
checked.value = !checked.value;
5656
5757
if (checked.value) {
58+
console.log(`Opening ${props.url}`);
5859
window.open(props.url, "_blank", "noopener,noreferrer");
5960
}
6061
};

Diff for: components/molecules/docs/CrateCard.vue

+32-43
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,84 @@
11
<template>
2-
<div class="card">
2+
<div class="card relative">
3+
<span v-if="crate.recentlyReleased && pingVisible" class="absolute top-1.5
4+
right-1.5 flex h-2.5 w-2.5" :class="{
5+
'opacity-0': !pingVisible,
6+
'opacity-100': pingVisible
7+
}" @click="pingVisible = false">
8+
<UTooltip text="This crate was recently released.">
9+
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
10+
<span class="relative inline-flex rounded-full h-2.5 w-2.5 bg-sky-500"></span>
11+
</UTooltip>
12+
</span>
313
<div>
414
<div class="header">
515
<div class="title">
616
In
7-
<Icon :name="category.icon" />
8-
{{ category.name }}
17+
<Icon :name="crate.category.icon" />
18+
{{ crate.category.name }}
919

1020
<div class="ml-1 font-normal text-xs font-mono">
1121
<div
1222
class="px-1 py-0.5 rounded-md text-green-900 dark:text-green-300 bg-green-300 dark:bg-green-900 border border-green-500"
13-
v-if="kind === Kind.Library"
14-
>
23+
v-if="crate.kind === Kind.Library">
1524
lib
1625
</div>
1726
<div
1827
class="px-1 py-0.5 rounded-md text-purple-900 dark:text-purple-300 bg-purple-300 dark:bg-purple-900 border border-purple-500"
19-
v-else-if="kind === Kind.Binary"
20-
>
28+
v-else-if="crate.kind === Kind.Binary">
2129
bin
2230
</div>
2331
</div>
2432
</div>
2533
<div class="flex gap-x-1.5">
26-
<a
27-
v-if="socials && socials.github"
34+
<a v-if="crate.socials && crate.socials.github"
2835
class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
29-
:href="socials.github"
30-
>
36+
:href="crate.socials.github">
3137
<Icon class="w-4 h-4" name="octicon:mark-github-16"></Icon>
3238
</a>
33-
<a
34-
v-if="socials && socials.docs"
39+
<a v-if="crate.socials && crate.socials.docs"
3540
class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
36-
:href="socials.docs"
37-
:title="`Chat about ${name} in the rust-seq Zulip`"
38-
>
41+
:href="crate.socials.docs" :title="`Chat about ${crate.name} in the rust-seq Zulip`">
3942
<Icon class="w-4 h-4" name="heroicons-outline:book-open"></Icon>
4043
</a>
41-
<a
42-
v-if="socials && socials.zulip"
44+
<a v-if="crate.socials && crate.socials.zulip"
4345
class="flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-slate-950 border border-gray-200 rounded-full"
4446
href="https://rustseq.zulipchat.com/join/coxb7c7b3bbahlfx7poeqqrd/"
45-
:title="`Chat about ${name} in the rust-seq Zulip`"
46-
>
47+
:title="`Chat about ${crate.name} in the rust-seq Zulip`">
4748
<Icon class="w-4 h-4" name="tabler:brand-zulip"></Icon>
4849
</a>
4950
</div>
5051
</div>
5152
<div class="flex items-center justify-start gap-x-1">
52-
<div class="crate">{{ organization }}/{{ name }}</div>
53+
<div class="crate">{{ crate.organization }}/{{ crate.name }}</div>
5354
</div>
5455
<div class="description">
55-
{{ description }}
56+
{{ crate.description }}
5657
</div>
5758
</div>
5859
<div class="terminal">
5960
<div class="command">
60-
<span class="prompt">$</span>
61-
<span v-if="kind === Kind.Library"> cargo add {{ name }} </span>
62-
<span v-if="kind === Kind.Binary"> cargo install {{ name }} </span>
61+
<span class="prompt">$ </span>
62+
<span v-if="crate.kind === Kind.Library">cargo add {{ crate.name }}</span>
63+
<span v-if="crate.kind === Kind.Binary">cargo install {{ crate.name }}</span>
6364
</div>
6465
<Icon class="copy" name="heroicons-outline:clipboard-copy"></Icon>
6566
</div>
6667
</div>
6768
</template>
6869

6970
<script setup lang="ts">
70-
import { Kind } from "~/components/molecules/docs/crate-card/kind";
71-
72-
interface Category {
73-
name: string;
74-
icon: string;
75-
}
76-
77-
interface Socials {
78-
github?: string;
79-
docs?: string;
80-
zulip: boolean;
81-
}
71+
import { type Crate, Kind } from "~/components/molecules/docs/crate-card/types";
72+
import { useStorage } from '@vueuse/core'
8273
8374
interface Props {
84-
name: string;
85-
kind: Kind;
86-
organization: string;
87-
category: Category;
88-
socials: Socials;
89-
description: string;
75+
crate: Crate;
9076
}
9177
9278
// Define props with TypeScript
9379
const props = defineProps<Props>();
80+
81+
const pingVisible = useStorage(`crates-page:ping-visible:${props.crate.organization}/${props.crate.name}`, true);
9482
</script>
9583

9684
<style scope lang="postcss">
@@ -174,6 +162,7 @@ const props = defineProps<Props>();
174162
.prompt {
175163
@apply font-bold;
176164
@apply text-purple-700;
165+
@apply select-none;
177166
}
178167
}
179168

Diff for: components/molecules/docs/crate-card/kind.ts

-4
This file was deleted.

Diff for: components/molecules/docs/crate-card/types.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export enum Kind {
2+
Binary,
3+
Library,
4+
}
5+
6+
export interface Category {
7+
name: string;
8+
icon: string;
9+
}
10+
11+
export interface Socials {
12+
github?: string;
13+
docs?: string;
14+
zulip: boolean;
15+
}
16+
17+
export interface Crate {
18+
name: string;
19+
kind: Kind;
20+
organization: string;
21+
category: Category;
22+
socials: Socials;
23+
description: string;
24+
recentlyReleased?: boolean;
25+
}

0 commit comments

Comments
 (0)