Skip to content

Commit

Permalink
tidy some more components
Browse files Browse the repository at this point in the history
  • Loading branch information
zaknesler committed Jun 1, 2024
1 parent 2e4031a commit a776c0b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions ui/src/components/feed/feed-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const BaseFeedItem: Component<BaseFeedItemProps> = props => (
<Image.Fallback as={RssIcon} />
</Image>
</Match>

<Match when={props.icon}>
<Dynamic component={props.icon} />
</Match>
Expand Down
13 changes: 6 additions & 7 deletions ui/src/components/feed/feed-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useLocation } from '@solidjs/router';
import { HiOutlineSquare3Stack3d } from 'solid-icons/hi';
import { For, Match, Switch, createSignal } from 'solid-js';
import { For, Match, Show, Switch, createSignal } from 'solid-js';
import { useFeeds } from '~/hooks/queries/use-feeds';
import { useFeedsStats } from '~/hooks/queries/use-feeds-stats';
import { useQueryState } from '~/hooks/use-query-state';
Expand All @@ -10,11 +10,11 @@ export const FeedList = () => {
const location = useLocation();
const state = useQueryState();

const [allFeedsMenuOpen, setAllFeedsMenuOpen] = createSignal(false);

const { feeds } = useFeeds();
const { totalStats } = useFeedsStats();

const [allFeedsMenuOpen, setAllFeedsMenuOpen] = createSignal(false);

return (
<div class="flex w-full flex-col gap-4">
<BaseFeedItem
Expand All @@ -31,17 +31,16 @@ export const FeedList = () => {
<h3 class="select-none font-semibold text-gray-500 text-xs uppercase tracking-wider dark:text-gray-400">
Feeds
</h3>

<Switch>
<Match when={feeds.isError}>
<p>Error: {feeds.error?.message}</p>
</Match>

<Match when={feeds.isSuccess}>
{feeds.data?.length ? (
<Show when={feeds.data?.length} fallback={<div>No feeds.</div>}>
<For each={feeds.data}>{feed => <FeedItem feed={feed} />}</For>
) : (
<div>No feeds.</div>
)}
</Show>
</Match>
</Switch>
</div>
Expand Down
8 changes: 1 addition & 7 deletions ui/src/components/menus/menu-settings.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
HiSolidArrowDownTray,
HiSolidArrowRightOnRectangle,
HiSolidCog,
HiSolidCog6Tooth,
HiSolidPlus,
} from 'solid-icons/hi';
import { HiSolidArrowDownTray, HiSolidArrowRightOnRectangle, HiSolidCog6Tooth, HiSolidPlus } from 'solid-icons/hi';
import { TiCog } from 'solid-icons/ti';
import { type Component, createSignal, mergeProps } from 'solid-js';
import { CreateFeedModal } from '../modals/create-feed';
Expand Down
7 changes: 5 additions & 2 deletions ui/src/components/ui/link.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { A, type AnchorProps } from '@solidjs/router';
import { cx } from 'class-variance-authority';
import type { Component, ParentProps } from 'solid-js';

type Props = ParentProps<AnchorProps>;

export const Link: Component<Props> = props => (
<A
{...props}
class="font-sans font-semibold text-gray-500 transition-colors dark:hover:text-white dark:text-gray-200 hover:text-gray-800 hover:underline"
classList={{ [String(props.class)]: !!props.class }}
class={cx(
'font-sans font-semibold text-gray-500 transition-colors dark:hover:text-white dark:text-gray-200 hover:text-gray-800 hover:underline',
props.class,
)}
>
{props.children}
</A>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools';
import { render } from 'solid-js/web';
import 'solid-devtools';
import Router from './router';
import 'solid-devtools';
import 'tailwindcss/tailwind.css';

const queryClient = new QueryClient();
Expand Down

0 comments on commit a776c0b

Please sign in to comment.