chore: add demo banner (#1739)

This commit is contained in:
boojack
2023-05-25 19:29:30 +08:00
committed by GitHub
parent e69f7c735b
commit 43819b021e
5 changed files with 69 additions and 24 deletions

View File

@ -0,0 +1,38 @@
import { useEffect, useState } from "react";
import { useGlobalStore } from "@/store/module";
import Icon from "./Icon";
interface State {
show: boolean;
}
const DemoBanner: React.FC = () => {
const globalStore = useGlobalStore();
const profile = globalStore.state.systemStatus.profile;
const [state, setState] = useState<State>({
show: false,
});
useEffect(() => {
const isDemo = profile.mode === "demo";
setState({
show: isDemo,
});
}, []);
if (!state.show) return null;
return (
<div className="flex flex-row items-center justify-center w-full py-2 text-lg font-medium dark:text-gray-300 bg-white dark:bg-zinc-700 shadow">
<div className="w-full max-w-6xl px-4 flex flex-row justify-between items-center gap-x-3">
<span>A lightweight, self-hosted memo hub. Open Source and Free forever.</span>
<a className="btn-primary shadow" href="https://usememos.com/docs/install/docker" target="_blank">
Install
<Icon.ExternalLink className="w-4 h-auto ml-1" />
</a>
</div>
</div>
);
};
export default DemoBanner;