Skip to content

Commit

Permalink
Merge pull request #5 from devklick/dev
Browse files Browse the repository at this point in the history
Refactor to use styled components
  • Loading branch information
devklick authored Oct 20, 2023
2 parents e372560 + 44d1d3c commit f12bbcb
Show file tree
Hide file tree
Showing 67 changed files with 955 additions and 716 deletions.
289 changes: 287 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@types/pako": "^2.0.1",
"@types/uuid": "^9.0.4",
"base64-js": "^1.5.1",
Expand Down
Empty file removed src/App.css
Empty file.
13 changes: 11 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import Desktop from "./components/Desktop";
import { Global, css } from "@emotion/react";

import "./App.css";
import Desktop from "./components/Desktop";
import useSystemSettings from "./stores/systemSettingsStore";

function App() {
const settings = useSystemSettings();
return (
<div className="App">
<Global
styles={css`
body {
color: ${settings.fontColor};
}
`}
/>
<Desktop />
</div>
);
Expand Down
35 changes: 0 additions & 35 deletions src/components/AppPopup/AppPopup.scss

This file was deleted.

16 changes: 6 additions & 10 deletions src/components/AppPopup/AppPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Rect } from "../../hooks/useDragToResize";
import useDetectMouseDownOutside from "../../hooks/useDetectMouseDownOutside";
import useSystemSettings from "../../stores/systemSettingsStore";

import "./AppPopup.scss";
import { StyledContent, StyledPopup } from "./styles";

interface AppPopupProps<Element extends HTMLElement> {
appRef: React.RefObject<Element>;
Expand Down Expand Up @@ -44,21 +44,17 @@ function AppPopup<Element extends HTMLElement>({
}

return (
<div
className="app-popup"
<StyledPopup
{...rect}
ref={thisRef}
style={{ ...rect }}
onContextMenu={handleContextMenu}
onClick={(e) => e.stopPropagation()}
onDoubleClick={(e) => e.stopPropagation()}
>
<div
className="app-popup__content"
style={{ backgroundColor: settings.mainColor }}
>
<StyledContent backgroundColor={settings.mainColor}>
{children}
</div>
</div>
</StyledContent>
</StyledPopup>
);
}

Expand Down
24 changes: 24 additions & 0 deletions src/components/AppPopup/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import styled from "@emotion/styled";
import { Rect } from "../../hooks/useDragToResize";

export const StyledPopup = styled.div<Rect>`
backdrop-filter: brightness(80%);
position: fixed;
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
top: ${(props) => props.top}px;
left: ${(props) => props.left}px;
width: ${(props) => props.width}px;
height: ${(props) => props.height}px;
`;

export const StyledContent = styled.div<{ backgroundColor: string }>`
width: 300px;
display: flex;
flex-direction: column;
box-shadow: 0 0 40px rgb(0, 0, 0, 0.5);
border-radius: 10px;
background-color: ${(props) => props.backgroundColor};
`;
23 changes: 0 additions & 23 deletions src/components/AppSideBar/AppSideBar.scss

This file was deleted.

26 changes: 10 additions & 16 deletions src/components/AppSideBar/AppSideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "./AppSideBar.scss";
import { StyledItem, StyledItemContainer, StyledSideBar } from "./styles";

interface SideBarItem {
title: string;
Expand All @@ -12,21 +12,15 @@ interface AppSideBarProps {

function AppSideBar({ items }: AppSideBarProps) {
return (
<div className="app-side-bar">
<div className="app-side-bar__items">
{items.map((item) => {
return (
<div
className={`app-side-bar__item ${item.isActive ? "active" : ""} `}
onClick={item.onClick}
key={item.title}
>
{item.title}
</div>
);
})}
</div>
</div>
<StyledSideBar>
<StyledItemContainer>
{items.map((item) => (
<StyledItem onClick={item.onClick} key={item.title}>
{item.title}
</StyledItem>
))}
</StyledItemContainer>
</StyledSideBar>
);
}

Expand Down
26 changes: 26 additions & 0 deletions src/components/AppSideBar/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import styled from "@emotion/styled";

export const StyledSideBar = styled.div`
grid-area: side-bar;
width: 100%;
height: 100%;
`;

export const StyledItemContainer = styled.div`
width: 100%;
box-sizing: border-box;
`;

export const StyledItem = styled.div`
border-radius: 10px;
padding: 6px 10px;
box-sizing: border-box;
box-shadow: 2px 2px 4px rgb(0, 0, 0, 0);
&:hover {
backdrop-filter: brightness(150%);
transition: ease-in 0.2s;
}
&:active {
box-shadow: 2px 2px 4px rgb(0, 0, 0, 0.5) inset;
}
`;
179 changes: 0 additions & 179 deletions src/components/BorderedApp/BorderedApp.scss

This file was deleted.

Loading

0 comments on commit f12bbcb

Please sign in to comment.