-
Notifications
You must be signed in to change notification settings - Fork 4
feat: responsive setup for mobile and desktop #159
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d13c459
feat: responsive setup for mobile and desktop
grv-saini-20 76f6422
fix: width of sidebar and rightaside
grv-saini-20 75746da
fix: responsive layout
grv-saini-20 442ca2c
feat: SideBar
grv-saini-20 8c354ec
fix: added some finishing touches to sidebar and button
grv-saini-20 6f4a2ef
fix: prevent pages transition on desktop
grv-saini-20 6c00adb
fix: icon center
grv-saini-20 5d72eb7
feat: settings page and icon added
grv-saini-20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
platforms/metagram/src/lib/fragments/SideBar/SideBar.stories.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { ComponentProps } from 'svelte'; | ||
import { SideBar } from '..'; | ||
|
||
export default { | ||
title: 'UI/SideBar', | ||
component: SideBar, | ||
tags: ['autodocs'], | ||
render: (args: { Component: SideBar; props: ComponentProps<typeof SideBar> }) => ({ | ||
Component: SideBar, | ||
props: args | ||
}) | ||
}; | ||
|
||
export const Primary = { | ||
args: {} | ||
}; |
136 changes: 136 additions & 0 deletions
136
platforms/metagram/src/lib/fragments/SideBar/SideBar.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<script lang="ts"> | ||
import type { HTMLAttributes } from 'svelte/elements'; | ||
import { Home, CommentsTwo, Search, Camera } from '$lib/icons'; | ||
import { goto } from '$app/navigation'; | ||
import { isNavigatingThroughNav } from '$lib/store/store.svelte'; | ||
import { page } from '$app/state'; | ||
|
||
interface IBottomNavProps extends HTMLAttributes<HTMLElement> { | ||
activeTab?: string; | ||
profileSrc: string; | ||
} | ||
let { | ||
activeTab = $bindable('home'), | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
profileSrc = 'https://picsum.photos/200' | ||
}: IBottomNavProps = $props(); | ||
|
||
const tabs = ['home', 'discover', 'post', 'messages', 'profile']; | ||
let _activeTab = $derived(page.url.pathname); | ||
|
||
const handleNavClick = (newTab: string) => { | ||
activeTab = newTab; | ||
goto(`/${newTab}`); | ||
}; | ||
|
||
$effect(() => { | ||
activeTab = _activeTab.split('/').pop() ?? ''; | ||
}); | ||
</script> | ||
|
||
<!-- svelte-ignore a11y_no_noninteractive_element_to_interactive_role --> | ||
<nav | ||
aria-label="Main navigation" | ||
class="hidden h-screen border border-y-0 border-e-gray-200 py-14 md:flex md:justify-center" | ||
role="tablist" | ||
> | ||
<div class="flex flex-col items-start justify-start gap-12"> | ||
<h1 class="text-transparent bg-clip-text bg-[image:var(--color-brand-gradient)]">Pictique</h1> | ||
<button | ||
type="button" | ||
class="flex items-center gap-2" | ||
aria-current={activeTab === 'home' ? 'page' : undefined} | ||
onclick={() => handleNavClick('home')} | ||
> | ||
<Home | ||
size="24px" | ||
color={activeTab === 'home' | ||
? 'var(--color-brand-burnt-orange)' | ||
: 'var(--color-black-400)'} | ||
fill={activeTab === 'home' ? 'var(--color-brand-burnt-orange)' : 'white'} | ||
/> | ||
<h3 class={`${activeTab === 'home' ? 'text-brand-burnt-orange' : 'text-black-800'}`}> | ||
Feed | ||
</h3> | ||
</button> | ||
|
||
<button | ||
type="button" | ||
class="flex items-center gap-2" | ||
aria-current={activeTab === 'discover' ? 'page' : undefined} | ||
onclick={() => handleNavClick('discover')} | ||
> | ||
<Search | ||
size="24px" | ||
color={activeTab === 'discover' | ||
? 'var(--color-brand-burnt-orange)' | ||
: 'var(--color-black-400)'} | ||
fill={activeTab === 'discover' ? 'var(--color-brand-burnt-orange)' : 'white'} | ||
/> | ||
<h3 | ||
class={`${activeTab === 'discover' ? 'text-brand-burnt-orange' : 'text-black-800'}`} | ||
> | ||
Search | ||
</h3> | ||
</button> | ||
|
||
<button | ||
type="button" | ||
class="flex items-center gap-2" | ||
aria-current={activeTab === 'post' ? 'page' : undefined} | ||
onclick={() => handleNavClick('post')} | ||
> | ||
<Camera | ||
size="24px" | ||
color={activeTab === 'post' | ||
? 'var(--color-brand-burnt-orange)' | ||
: 'var(--color-black-400)'} | ||
fill={activeTab === 'post' ? 'var(--color-brand-burnt-orange)' : 'white'} | ||
/> | ||
<h3 class={`${activeTab === 'post' ? 'text-brand-burnt-orange' : 'text-black-800'}`}> | ||
Upload a photo | ||
</h3> | ||
</button> | ||
|
||
<button | ||
type="button" | ||
class="flex items-center gap-2" | ||
aria-current={activeTab === 'messages' ? 'page' : undefined} | ||
onclick={() => handleNavClick('messages')} | ||
> | ||
<CommentsTwo | ||
size="24px" | ||
color={activeTab === 'messages' | ||
? 'var(--color-brand-burnt-orange)' | ||
: 'var(--color-black-400)'} | ||
fill={activeTab === 'messages' ? 'var(--color-brand-burnt-orange)' : 'white'} | ||
/> | ||
<h3 | ||
class={`${activeTab === 'messages' ? 'text-brand-burnt-orange' : 'text-black-800'}`} | ||
> | ||
Messages | ||
</h3> | ||
</button> | ||
|
||
<button | ||
type="button" | ||
class="flex items-center gap-2" | ||
aria-current={activeTab === 'profile' ? 'page' : undefined} | ||
onclick={() => handleNavClick('profile')} | ||
> | ||
<span | ||
class={`inline-block w-full rounded-full border p-1 ${activeTab === 'profile' ? 'border-brand-burnt-orange' : 'border-transparent'}`} | ||
> | ||
<img | ||
width="24px" | ||
height="24px" | ||
class="aspect-square rounded-full" | ||
src={profileSrc} | ||
alt="profile" | ||
/> | ||
</span> | ||
<h3 class={`${activeTab === 'profile' ? 'text-brand-burnt-orange' : 'text-black-800'}`}> | ||
Profile | ||
</h3> | ||
</button> | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
</nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/state'; | ||
import { BottomNav } from '$lib/fragments'; | ||
import SideBar from '$lib/fragments/SideBar/SideBar.svelte'; | ||
let { children } = $props(); | ||
|
||
let route = $derived(page.url.pathname); | ||
</script> | ||
|
||
<main> | ||
{@render children()} | ||
<main class="block h-[100dvh] grid-cols-[22vw_auto_31vw] md:grid"> | ||
<SideBar profileSrc="https://picsum.photos/200" /> | ||
<section> | ||
{@render children()} | ||
</section> | ||
{#if !route.endsWith('/messages')} | ||
<aside class="hidden border border-y-0 border-s-gray-200 md:block">Right Aside</aside> | ||
{/if} | ||
<BottomNav profileSrc="https://picsum.photos/200" /> | ||
</main> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { isNavigatingThroughNav } from '$lib/store/store.svelte'; | ||
import { Button } from '$lib/ui'; | ||
</script> | ||
|
||
<h1>Home</h1> | ||
<Button | ||
callback={async () => { | ||
(isNavigatingThroughNav.value = false), goto('/discover'); | ||
}}>discover</Button | ||
> | ||
<main>Main</main> |
2 changes: 1 addition & 1 deletion
2
platforms/metagram/src/routes/(protected)/messages/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<script lang="ts"> | ||
</script> | ||
|
||
<h1>Messages</h1> | ||
<main>Messages</main> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,6 @@ | |
}); | ||
</script> | ||
|
||
<main> | ||
<main class="h-[100dvh] px-4 md:px-0"> | ||
{@render children()} | ||
</main> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.