display site name (#2)

This commit is contained in:
Florian Herrengt 2023-08-04 18:55:21 +01:00 committed by GitHub
parent e6a6e11517
commit d3d450c146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 21 deletions

View File

@ -5,6 +5,7 @@
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-size: 12px; font-size: 12px;
background-color: #2b2b2b; background-color: #2b2b2b;
color: #d9d9d9;
} }
</style> </style>
<div id="root"></div> <div id="root"></div>

View File

@ -78,13 +78,14 @@ export const Dropdown: React.FC<DropdownProps> = (props) => {
display: "grid", display: "grid",
alignItems: "center", alignItems: "center",
gap: 2, gap: 2,
lineHeight: 2.4,
}} }}
> >
<span style={{ flex: 1 }}> <span style={{ flex: 1 }}>
{props.options.find(({ value }) => selected === value)!.label} {props.options.find(({ value }) => selected === value)!.label}
</span> </span>
<Icon <Icon
styles={{ textAlign: "right", marginRight: 12 }} styles={{ textAlign: "right", marginRight: 12, marginLeft: 12 }}
name="chevron-down" name="chevron-down"
/> />
</div> </div>

View File

@ -17,10 +17,6 @@ export const icons = {
), ),
"chevron-down": ( "chevron-down": (
<svg <svg
style={{
position: "absolute",
top: -2,
}}
width="9" width="9"
height="6" height="6"
viewBox="0 0 9 6" viewBox="0 0 9 6"

View File

@ -5,11 +5,13 @@ import { MetricType } from "../generated/graphql";
export const MetricDetailsPage: React.FC = () => { export const MetricDetailsPage: React.FC = () => {
const [path, setPath] = useState<string>(); const [path, setPath] = useState<string>();
const [name, setName] = useState<string>();
const [timeframe, setTimeframe] = useState<string>("Last30days"); const [timeframe, setTimeframe] = useState<string>("Last30days");
useEffect(() => { useEffect(() => {
const unsubscribeCurrentPage = webflow.subscribe("currentpage", (page) => { const unsubscribeCurrentPage = webflow.subscribe("currentpage", (page) => {
setPath(`/${page.getSlug()}`); setPath(`/${page.getSlug()}`);
setName(`${page.getName()}`);
}); });
webflow.getCurrentPage().then((page) => setPath(`/${page.getSlug()}`)); webflow.getCurrentPage().then((page) => setPath(`/${page.getSlug()}`));
return () => { return () => {
@ -19,6 +21,20 @@ export const MetricDetailsPage: React.FC = () => {
return ( return (
<div> <div>
<div style={{ display: "flex" }}>
<div
style={{
flex: 1,
fontSize: 15,
lineHeight: 2,
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
minWidth: 0,
}}
>
{name}
</div>
<Dropdown <Dropdown
selected="Last30days" selected="Last30days"
options={[ options={[
@ -32,6 +48,7 @@ export const MetricDetailsPage: React.FC = () => {
setTimeframe(value); setTimeframe(value);
}} }}
/> />
</div>
<div style={{ marginTop: 10 }}> <div style={{ marginTop: 10 }}>
<Chart input={{ path, metricType: MetricType.View, timeframe }} /> <Chart input={{ path, metricType: MetricType.View, timeframe }} />
</div> </div>

View File

@ -13,9 +13,6 @@ export default defineConfig({
host: true, host: true,
port: 1337, port: 1337,
}, },
optimizeDeps: {
exclude: ["./webflow"],
},
define: { define: {
"process.env": { "process.env": {
...process.env, ...process.env,