enhance(structure):基本完成项目结构的创建。
This commit is contained in:
parent
9297f574f4
commit
f1db0119de
26
src/components/NavigationBar.tsx
Normal file
26
src/components/NavigationBar.tsx
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import { Spacer } from "@/foundations";
|
||||||
|
import { flex, mq } from "@/style-predefines";
|
||||||
|
import { css } from "@emotion/react";
|
||||||
|
import styled from "@emotion/styled";
|
||||||
|
import chroma from "chroma-js";
|
||||||
|
|
||||||
|
const NavigationContainer = styled.div(
|
||||||
|
({ theme }) => css`
|
||||||
|
height: 100%;
|
||||||
|
width: ${theme.spacings.xxs * 36}px;
|
||||||
|
padding-top: ${theme.spacings.xxs * 24}px;
|
||||||
|
background-color: ${chroma(theme.backgroundColor.light).darken(0.3).hex()};
|
||||||
|
${flex(theme, "column", "flex-start", "stretch", "sm")}
|
||||||
|
${mq.dark} {
|
||||||
|
background-color: ${chroma(theme.backgroundColor.dark).brighten(0.3).hex()};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
export function NavigationBar() {
|
||||||
|
return (
|
||||||
|
<NavigationContainer>
|
||||||
|
<Spacer />
|
||||||
|
</NavigationContainer>
|
||||||
|
);
|
||||||
|
}
|
17
src/components/WindowMoveHandler.tsx
Normal file
17
src/components/WindowMoveHandler.tsx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { css } from "@emotion/react";
|
||||||
|
import styled from "@emotion/styled";
|
||||||
|
|
||||||
|
const Handler = styled.div(
|
||||||
|
({ theme }) => css`
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: ${theme.spacings.xxs * 24}px;
|
||||||
|
z-index: 1;
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
export function WindowMoveHandler() {
|
||||||
|
return <Handler data-tauri-drag-region />;
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
import { css } from "@emotion/react";
|
|
||||||
import styled from "@emotion/styled";
|
|
||||||
|
|
||||||
const Handler = styled.div(({ theme }) =>
|
|
||||||
css({
|
|
||||||
position: "fixed",
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
height: theme.spacings.xxs * 24,
|
|
||||||
zIndex: 1,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
export function WindowMoveHandler() {
|
|
||||||
return <Handler data-tauri-drag-region />;
|
|
||||||
}
|
|
|
@ -1 +1,2 @@
|
||||||
export { WindowMoveHandler } from "./WindowMoveHandler/WindowMoveHandler";
|
export { NavigationBar } from "./NavigationBar";
|
||||||
|
export { WindowMoveHandler } from "./WindowMoveHandler";
|
||||||
|
|
42
src/foundations/Avatar.tsx
Normal file
42
src/foundations/Avatar.tsx
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import { flex } from "@/style-predefines";
|
||||||
|
import { css, useTheme } from "@emotion/react";
|
||||||
|
import styled from "@emotion/styled";
|
||||||
|
import { __, always, cond, includes, T } from "ramda";
|
||||||
|
import { PropsWithChildren } from "react";
|
||||||
|
|
||||||
|
type AvatarProps = {
|
||||||
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
|
||||||
|
square?: boolean;
|
||||||
|
bgColor?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const AvatarContainer = styled("div")<AvatarProps>(({ theme, size, square }) => {
|
||||||
|
const radiusSize = cond([
|
||||||
|
[includes(__, ["xs", "sm", "md"]), always("xxs")],
|
||||||
|
[T, always("xs")],
|
||||||
|
])(size);
|
||||||
|
return css`
|
||||||
|
height: ${theme.spacings[size]};
|
||||||
|
width: ${theme.spacings[size]};
|
||||||
|
border-radius: ${theme.radius[square ? "none" : radiusSize]};
|
||||||
|
overflow: hidden;
|
||||||
|
${flex(theme, "row", "center", "center")}
|
||||||
|
.child {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
export function Avatar({
|
||||||
|
size = "md",
|
||||||
|
square = false,
|
||||||
|
bgColor,
|
||||||
|
children,
|
||||||
|
}: PropsWithChildren<AvatarProps>) {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<AvatarContainer size={size} square={square}>
|
||||||
|
<div className="child">{children}</div>
|
||||||
|
</AvatarContainer>
|
||||||
|
);
|
||||||
|
}
|
10
src/foundations/Spacer.tsx
Normal file
10
src/foundations/Spacer.tsx
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { css } from "@emotion/react";
|
||||||
|
import styled from "@emotion/styled";
|
||||||
|
|
||||||
|
export const Spacer = styled.div(
|
||||||
|
() => css`
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
align-self: stretch;
|
||||||
|
`
|
||||||
|
);
|
|
@ -0,0 +1 @@
|
||||||
|
export { Spacer } from "./Spacer";
|
|
@ -1,22 +1,27 @@
|
||||||
import { WindowMoveHandler } from "@/components";
|
import { NavigationBar, WindowMoveHandler } from "@/components";
|
||||||
import { flex } from "@/style-predefines";
|
import { flex } from "@/style-predefines";
|
||||||
import { css } from "@emotion/react";
|
import { css } from "@emotion/react";
|
||||||
import styled from "@emotion/styled";
|
import styled from "@emotion/styled";
|
||||||
|
|
||||||
const LayoutContainer = styled.div(({ theme }) =>
|
const LayoutContainer = styled.div(
|
||||||
css({
|
({ theme }) => css`
|
||||||
height: "100vh",
|
height: 100%;
|
||||||
width: "100vw",
|
width: 100%;
|
||||||
paddingTop: theme.spacings.xxs * 24,
|
overflow: hidden;
|
||||||
...flex(theme, "row", "flex-start", "stretch"),
|
${flex(theme, "row", "flex-start", "stretch")}
|
||||||
overflow: "hidden",
|
.main-content {
|
||||||
})
|
flex-grow: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
export function MainLayout() {
|
export function MainLayout() {
|
||||||
return (
|
return (
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<WindowMoveHandler />
|
<WindowMoveHandler />
|
||||||
|
<NavigationBar />
|
||||||
|
<div className="main-content">Main Content</div>
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user