-
Notifications
You must be signed in to change notification settings - Fork 4
feat: added settings tile component. #184
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c1d3e5
feat: added settings tile component.
Sahil2004 2ddeeaa
chore: fixed the naming convention
Sahil2004 72ec71a
fix: merge conflict.
Sahil2004 f04a6c2
chore: renamed callback to onclick
Sahil2004 95cfbd5
fix: fixed the use of restProps
Sahil2004 3031fc4
fix: fixed the unnecessary onclick expose.
Sahil2004 7f10bea
fix: fixed the join function params.
Sahil2004 a0f73a5
fix: merge conflict.
Sahil2004 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
23 changes: 23 additions & 0 deletions
23
platforms/metagram/src/lib/fragments/SettingsTile/SettingsTile.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,23 @@ | ||
import type { ComponentProps } from "svelte"; | ||
import SettingsTile from "./SettingsTile.svelte"; | ||
|
||
export default { | ||
title: "UI/SettingsTile", | ||
component: SettingsTile, | ||
tags: ["autodocs"], | ||
render: (args: { | ||
Component: SettingsTile; | ||
props: ComponentProps<typeof SettingsTile>; | ||
}) => ({ | ||
Component: SettingsTile, | ||
props: args, | ||
}), | ||
}; | ||
|
||
export const Primary = { | ||
args: { | ||
title: "Who can see your posts?", | ||
currentStatus: "Only followers", | ||
callback: () => alert("clicked"), | ||
}, | ||
}; |
25 changes: 25 additions & 0 deletions
25
platforms/metagram/src/lib/fragments/SettingsTile/SettingsTile.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,25 @@ | ||
<script lang="ts"> | ||
import { ArrowRight01Icon } from '@hugeicons/core-free-icons'; | ||
import { HugeiconsIcon } from '@hugeicons/svelte'; | ||
import type { HTMLButtonAttributes } from 'svelte/elements'; | ||
|
||
interface IAvatarProps extends HTMLButtonAttributes { | ||
title: string; | ||
currentStatus: 'string'; | ||
callback: () => void; | ||
} | ||
|
||
const { title, currentStatus, callback, ...restProps }: IAvatarProps = $props(); | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
</script> | ||
|
||
<button | ||
class="flex w-full cursor-pointer items-center justify-between" | ||
onclick={callback} | ||
{...restProps} | ||
> | ||
<div class="flex flex-col items-start gap-1"> | ||
<span class="font-semibold">{title}</span> | ||
<span class="text-black/60">{currentStatus}</span> | ||
</div> | ||
<HugeiconsIcon icon={ArrowRight01Icon} className="text-black/40" /> | ||
</button> |
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,16 +1,17 @@ | ||
export { default as Header } from './Header/Header.svelte'; | ||
export { default as BottomNav } from './BottomNav/BottomNav.svelte'; | ||
export { default as SettingsNavigationButton } from './SettingsNavigationButton/SettingsNavigationButton.svelte'; | ||
export { default as MessageInput } from './MessageInput/MessageInput.svelte'; | ||
export { default as InputFile } from './InputFile/InputFile.svelte'; | ||
export { default as Drawer } from './Drawer/Drawer.svelte'; | ||
export { default as Message } from './Message/Message.svelte'; | ||
export { default as ActionMenu } from './ActionMenu/ActionMenu.svelte'; | ||
export { default as Modal } from './Modal/Modal.svelte'; | ||
export { default as SideBar } from './SideBar/SideBar.svelte'; | ||
export { default as RightAside } from './RightAside/RightAside.svelte'; | ||
export { default as SettingsToggleButton } from './SettingsToggleButton/SettingsToggleButton.svelte'; | ||
export { default as Post } from './Post/Post.svelte'; | ||
export { default as ChatMessage } from './ChatMessage/ChatMessage.svelte'; | ||
export { default as Comment } from './Comment/Comment.svelte'; | ||
export { default as SettingsDeleteButton } from './SettingsDeleteButton/SettingsDeleteButton.svelte'; | ||
export { default as Header } from "./Header/Header.svelte"; | ||
export { default as BottomNav } from "./BottomNav/BottomNav.svelte"; | ||
export { default as SettingsNavigationButton } from "./SettingsNavigationButton/SettingsNavigationButton.svelte"; | ||
export { default as MessageInput } from "./MessageInput/MessageInput.svelte"; | ||
export { default as InputFile } from "./InputFile/InputFile.svelte"; | ||
export { default as Drawer } from "./Drawer/Drawer.svelte"; | ||
export { default as Message } from "./Message/Message.svelte"; | ||
export { default as ActionMenu } from "./ActionMenu/ActionMenu.svelte"; | ||
export { default as Modal } from "./Modal/Modal.svelte"; | ||
export { default as SideBar } from "./SideBar/SideBar.svelte"; | ||
export { default as RightAside } from "./RightAside/RightAside.svelte"; | ||
export { default as SettingsToggleButton } from "./SettingsToggleButton/SettingsToggleButton.svelte"; | ||
export { default as Post } from "./Post/Post.svelte"; | ||
export { default as ChatMessage } from "./ChatMessage/ChatMessage.svelte"; | ||
export { default as Comment } from "./Comment/Comment.svelte"; | ||
export { default as SettingsDeleteButton } from "./SettingsDeleteButton/SettingsDeleteButton.svelte"; | ||
export { default as SettingsTile } from "./SettingsTile/SettingsTile.svelte"; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix interface name and type definition.
The interface has two issues:
IAvatarProps
should beISettingsTileProps
to match the componentcurrentStatus
type should bestring
not'string'
(literal string type)📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??? @Sahil2004
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also why string? hard type it with statuses as mentioned like 'only-followers' | 'public' assume the enumeration for now