Skip to content

Instantly share code, notes, and snippets.

@roni5
Forked from Hachikoi-the-creator/Stuff.tsx
Last active May 20, 2024 20:22
Show Gist options
  • Select an option

  • Save roni5/21b44d2c493c2698ff245667c9d8b2c1 to your computer and use it in GitHub Desktop.

Select an option

Save roni5/21b44d2c493c2698ff245667c9d8b2c1 to your computer and use it in GitHub Desktop.
Solutions
Here are two main approaches to fix this:
Grid Layout (Recommended)
Grid is a more powerful layout system for scenarios like this:
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 min-h-screen">
<aside className="hidden md:block col-span-1 ...Left Sidebar styles...">
...Left Sidebar Content...
</aside>
<main className="col-span-1 md:col-span-1 ...Main content styles...">
...Main Content...
</main>
<aside className="hidden md:block col-span-1 ...Right Sidebar styles...">
...Right Sidebar Content...
</aside>
</div>
We use grid grid-cols-1 md:grid-cols-3 to create a single-column layout on smaller screens (md:grid-cols-1) and a three-column layout on medium screens and up (md:grid-cols-3).
col-span-1 ensures each section spans one column.
gap-6 adds spacing between the columns.
Flexbox with Nesting (Less Ideal)
You can use flexbox, but you'll need additional nesting:
<div className="flex flex-col min-h-screen">
<div className="flex"> <aside>Left Sidebar</aside> <main>Main Content</main> </aside>Right Sidebar</aside> </div>
</div>
Create a new div with flex inside the main div.
Place the left sidebar, main content, and right sidebar within this new flex container.
Additional Tips
Inspect Element: Use your browser's developer tools (right-click > "Inspect" or "Inspect Element") to examine the rendered HTML structure and how the elements are being laid out. This can often help you visualize the problem.
Simplify: When debugging hydration errors, try temporarily removing or commenting out sections of your code to isolate the problematic area. This can help you zero in on the exact cause.
Let me know if you have any more questions or if you'd like help with specific layout adjustments!

Create a new asset

Choose an Encoding Tier NEW Select either baseline or smart encoding.

Learn more about our encoding tiers

Baseline

Smart

Set Max Resolution The highest resolution available will be 2160p.

Learn more about max resolution

1080p

1440p

4k

Add Generated Captions NEW We'll use speech recognition technology to generate captions.

Learn more about generated captions

Disabled

Enabled Use a video URL to create an asset in Mux Update "input" with your video's URL in the post body editor below, or run the request as-is to view our test video.

POST https://api.mux.com/video/v1/assets 1 2 3 4 5 6 7 8 { "input": "https://storage.googleapis.com/muxdemofiles/mux.mp4", "playback_policy": [ "public" ], "max_resolution_tier": "2160p", "encoding_tier": "smart" }

Run request Or upload a video directly to Mux Run the request below to walkthrough how to upload a video from your machine.

Learn more about direct uploads POST https://api.mux.com/video/v1/uploads 1 2 3 4 5 6 7 8 9 10 { "new_asset_settings": { "playback_policy": [ "public" ], "max_resolution_tier": "2160p", "encoding_tier": "smart" }, "cors_origin": "*" }

Run request

import React, { useState } from "react";
import { auth } from "../firebase";
import {
signInWithPopup,
GoogleAuthProvider,
AuthProvider,
getAuth
} from "firebase/auth";
import { useAuthState } from "react-firebase-hooks/auth";
interface UserInfo {
displayName: string | null;
email: string | null;
phoneNumber: string | null;
photoURL: string | null;
providerId: string;
uid: string;
}
export const Login = () => {
const [user, setUser] = useAuthState(auth);
const googleAuth = new GoogleAuthProvider();
const auth1 = getAuth();
// console.log(user?.email)
const login = async (authType: AuthProvider) => {
try {
if (!user) {
const result = await signInWithPopup(auth, authType);
console.log(result);
}
} catch (error) {
console.log(error);
}
};
return (
<>
<div className="flex flex-col">
<button
type="button"
onClick={() => login(googleAuth)}
className="text-white m-2 bg-[#6f6f70] hover:bg-[#6f6f70]/90 focus:ring-4 focus:outline-none focus:ring-[#4285F4]/50 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-[#4285F4]/55 mr-2 mb-2"
>
Sign in / Log in with Google
</button>
</div>
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment