Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: modernize styles #64

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension/src/components/CookiesWarning.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function CookiesWarning() {
return (
<div className="flex h-screen flex-col items-center border-y-8 border-r-8 border-lc-border-light bg-lc-bg-light p-2 text-sm text-lc-text-light dark:border-lc-border dark:bg-lc-bg dark:text-white">
<div className="flex h-screen flex-col items-center bg-lc-bg-light p-2 text-sm text-lc-text-light dark:bg-lc-bg dark:text-white">
<div className="text-center text-xl font-semibold text-yellow-400">
⚠️ Third-party cookies are disabled
</div>
Expand Down
2 changes: 1 addition & 1 deletion extension/src/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function Home({ session }: { session: SessionResponse }) {
);
} else {
return (
<div className="flex h-screen flex-col items-center justify-center border-y-8 border-r-8 border-lc-border-light bg-lc-bg-light p-2 text-sm dark:border-lc-border dark:bg-lc-bg">
<div className="flex h-screen flex-col items-center justify-center bg-lc-bg-light p-2 text-sm dark:bg-lc-bg">
<div className="mr-4 flex w-full flex-col items-end">
<SignOutButton />
</div>
Expand Down
4 changes: 2 additions & 2 deletions extension/src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Login() {

if (isLoading) {
return (
<div className="flex h-screen flex-col items-center justify-center border-y-8 border-r-8 border-lc-border-light bg-lc-bg-light p-2 text-sm dark:border-lc-border dark:bg-lc-bg">
<div className="flex h-screen flex-col items-center justify-center bg-lc-bg-light p-2 text-sm dark:bg-lc-bg">
<Spinner />
</div>
);
Expand All @@ -43,7 +43,7 @@ export default function Login() {
return <Home session={session} />;
} else {
return (
<div className="flex h-screen flex-col items-center border-y-8 border-r-8 border-lc-border-light bg-lc-bg-light p-2 text-sm dark:border-lc-border dark:bg-lc-bg">
<div className="flex h-screen flex-col items-center bg-lc-bg-light p-2 text-sm dark:bg-lc-bg">
<a
href="https://github.com/marwanhawari/LeetRooms"
rel="noopener noreferrer"
Expand Down
4 changes: 2 additions & 2 deletions extension/src/components/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default function Room({
}, [messages]);

return (
<div className="flex h-screen flex-col gap-y-2 border-y-8 border-r-8 border-lc-border-light bg-lc-bg-light px-2 text-sm text-lc-text-light dark:border-lc-border dark:bg-lc-bg dark:text-white">
<div className="flex h-screen flex-col gap-y-2 bg-lc-bg-light px-2 text-sm text-lc-text-light dark:bg-lc-bg dark:text-white">
<div className="mx-2 mt-2 flex flex-col" id="first-box">
<div
className="flex flex-row items-start justify-between"
Expand All @@ -269,7 +269,7 @@ export default function Room({
<div
id="copy-button"
onClick={handleCopy}
className="cursor-pointer rounded-md bg-lc-fg-light p-2 transition-all hover:bg-zinc-200 dark:bg-lc-fg dark:hover:bg-zinc-600"
className="cursor-pointer select-none rounded-md bg-lc-fg-light p-2 transition-all hover:bg-zinc-200 dark:bg-lc-fg dark:hover:bg-zinc-600"
>
{hasClickedCopyIcon ? (
<CheckMarkIcon />
Expand Down
17 changes: 8 additions & 9 deletions extension/src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ const XIconSVG = `
></path>
</svg>`;

const dragHandlebarSVG = `<svg class="handlebar-svg" id="drag-handlebar-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 14" width="2" height="14">
<circle r="1" transform="matrix(4.37114e-08 -1 -1 -4.37114e-08 1 1)"></circle>
<circle r="1" transform="matrix(4.37114e-08 -1 -1 -4.37114e-08 1 7)"></circle>
<circle r="1" transform="matrix(4.37114e-08 -1 -1 -4.37114e-08 1 13)"></circle>
</svg>`;
const dragHandlebarSVG = `<svg class="handlebar-svg" id="drag-handlebar-svg" width="2" height="20" viewBox="0 0 2 20" xmlns="http://www.w3.org/2000/svg">
<rect width="2" height="20"/>
</svg>`;

const openHandlebarSVG = `<svg class="handlebar-svg" id="open-handlebar-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
<path fill-rule="evenodd" d="M7.913 19.071l7.057-7.078-7.057-7.064a1 1 0 011.414-1.414l7.764 7.77a1 1 0 010 1.415l-7.764 7.785a1 1 0 01-1.414-1.414z" clip-rule="evenodd"></path>
Expand All @@ -30,9 +28,8 @@ async function main() {
const handlebar = document.createElement("div");
handlebar.id = "leetrooms-handlebar";
handlebar.style.minWidth = "8px";
handlebar.style.userSelect = "none"; // This line disables text selection on the handlebar
handlebar.style.userSelect = "none";
handlebar.style.position = "relative";
handlebar.style.left = "-4px";

const overlay = document.createElement("div");
overlay.style.position = "absolute";
Expand Down Expand Up @@ -64,8 +61,10 @@ async function main() {
function setToggleState(toggleState: boolean) {
if (toggleState) {
reactRoot.style.display = "block";
handlebar.innerHTML = dragHandlebarSVG;
handlebar.style.cursor = "col-resize";
handlebar.innerHTML = `
<div id="handlebar-highlight">${dragHandlebarSVG}</div>
`;
handlebar.style.cursor = "ew-resize";
chrome.storage.local.set({ leetroomsToggleState: true });
isOpen = true;
handlebar.style.zIndex = "10";
Expand Down
45 changes: 37 additions & 8 deletions extension/src/public/content.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,61 @@
#leetrooms-iframe {
border-radius: 0.5rem;
}

#leetrooms-handlebar {
display: flex;
justify-content: center;
align-items: center;
margin-top: 8px;
margin-bottom: 8px;
border-radius: 5px;
}

#handlebar-highlight {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}

#leetrooms-handlebar:hover {
#leetrooms-handlebar:hover > #handlebar-highlight {
background-color: rgb(0, 132, 255);
}

#leetrooms-handlebar:active {
#leetrooms-handlebar:active > #handlebar-highlight {
background-color: rgb(0, 132, 255);
}

#leetrooms-handlebar:not(:has(#handlebar-highlight)) {
margin-left: 3px;
}

#leetrooms-handlebar:hover:not(:has(#handlebar-highlight)) {
background-color: rgb(0, 132, 255);
}

#leetrooms-handlebar:active:not(:has(#handlebar-highlight)) {
background-color: rgb(0, 132, 255);
}

.handlebar-svg {
margin-bottom: 48px;
fill: gray;
fill: rgb(58, 58, 58);
}

#open-handlebar-svg {
transform: rotate(180deg);
}

#leetrooms-handlebar:hover > .handlebar-svg {
#leetrooms-handlebar:hover #drag-handlebar-svg {
fill: rgb(0, 132, 255);
}

#leetrooms-handlebar:active #drag-handlebar-svg {
fill: rgb(0, 132, 255);
}

#leetrooms-handlebar:hover > #open-handlebar-svg {
fill: white;
}

#leetrooms-handlebar:active > .handlebar-svg {
#leetrooms-handlebar:active > #open-handlebar-svg {
fill: white;
}
Loading