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

Project rename #56

Merged
merged 20 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0f8357e
feat(snippet): create query to retrieve public snippets
tericcabrel Oct 23, 2022
a320850
feat(snippet): browse snippets
tericcabrel Oct 30, 2022
09c18ce
chore(snippet): create the column to save the highlighted snippet
tericcabrel Oct 30, 2022
fc0449f
enh(core): add content highlighted in the snippet schema
tericcabrel Oct 30, 2022
e310f48
feat(snippet): include the highlighted when creating a snippet
tericcabrel Oct 30, 2022
ceac0b3
feat(snippet): include the highlighted when updating a snippet
tericcabrel Oct 30, 2022
113d08a
test(snippet): write tests case for updating and deleting a snippet
tericcabrel Oct 30, 2022
e4ec3ef
test(domain): test the newsletter service
tericcabrel Oct 30, 2022
a347896
test(domain): test folders deletion
tericcabrel Oct 30, 2022
8b8d899
test(domain): test users service remaining cases
tericcabrel Oct 30, 2022
5d85638
feat(snippet): manually select the language of a code snippet
tericcabrel Nov 9, 2022
c905424
feat(snippet): set the current language as the default when editing
tericcabrel Nov 11, 2022
658c924
feat(snippet): update the resolver to retrieve snippet content
tericcabrel Nov 12, 2022
2529007
style(snippet): style the code preview on snippets list
tericcabrel Nov 14, 2022
c771084
style(snippet): complete the ui to browse public snippet
tericcabrel Nov 20, 2022
d76d74a
chore(web): replace default exports with named exports
tericcabrel Nov 20, 2022
89a3002
feat(snippet): write the client query to find public snippets
tericcabrel Nov 21, 2022
5df324d
feat(snippet): implement pagination navigation on client side - wip
tericcabrel Nov 22, 2022
0f8a8ff
feat(snippet): add more filter on public snippets query
tericcabrel Nov 24, 2022
7d0d781
chore: project rename
tericcabrel Nov 1, 2023
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
Prev Previous commit
Next Next commit
style(snippet): complete the ui to browse public snippet
  • Loading branch information
tericcabrel committed Nov 20, 2022
commit c77108493906a17e86ec849d59332c440d5f65b8

This file was deleted.

8 changes: 0 additions & 8 deletions apps/web/src/components/snippets/public-snippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ export const PublicSnippet = ({ snippet }: Props) => {
<div className="text-xs text-gray-400">{snippet.createdAt}</div>
</div>
</div>
<div>
<button
className="inline-flex items-center rounded border border-gray-300 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-700 shadow-sm hover:bg-gray-50"
type="button"
>
0 Stars
</button>
</div>
</div>
<div className="ml-12">{snippet.description}</div>
<div
Expand Down
48 changes: 42 additions & 6 deletions apps/web/src/containers/private/browse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { PublicSnippetResult } from '@sharingan/front';
import { Button, Icon, PublicSnippetResult } from '@sharingan/front';
import SelectInput from '@sharingan/front/src/forms/select-input';
import { SelectOption } from '@sharingan/front/src/typings/components';
import { NextSeo } from 'next-seo';
import { useState } from 'react';

import Layout from '@/components/layout/private/layout';
import { PublicSnippet } from '@/components/snippets/public-snippet';
Expand All @@ -8,7 +11,15 @@ type Props = {
data: PublicSnippetResult;
};

const sortOptions: SelectOption[] = [
{ id: 'recently-created', label: 'Sort: recently created' },
{ id: 'recently-updated', label: 'Sort: recently updated' },
];

const Browse = ({ data }: Props) => {
const [sortOption, setSortOption] = useState<SelectOption>(sortOptions[0]);
const [search, setSearch] = useState<string | undefined>();

console.log(data);

const snippets = data.items;
Expand All @@ -17,19 +28,44 @@ const Browse = ({ data }: Props) => {
<Layout>
<NextSeo title="Browse" />
<div className="py-10">
<header>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h1 className="text-3xl font-bold leading-tight text-gray-900">Browse</h1>
</div>
</header>
<main>
<div className="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div className="w-full mx-auto border-b border-gray-400 flex justify-between pb-4">
<div className="relative mt-1 rounded-md shadow-sm w-1/4">
<input
className="block w-full rounded-md border-gray-300 pr-10 sm:text-sm"
id="account-number"
name="account-number"
placeholder="Search..."
type="text"
/>
<div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
<Icon.OutlineSearch className="h-5 w-5 text-gray-400" />
</div>
</div>
<SelectInput
className="w-1/5 cursor-pointer"
options={sortOptions}
value={sortOption}
onChange={setSortOption}
/>
</div>
<div className="px-4 py-8 sm:px-0">
<div className="space-y-6 min-h-96">
{snippets.map((snippet) => (
<PublicSnippet key={snippet.id} snippet={snippet} />
))}
</div>
<div className="w-full flex justify-center mt-10 space-x-4">
<Button className="bg-gray-200 w-auto items-center" color="white-gray">
<Icon.ChevronDoubleLeftIcon className="w-6 h-4" />
Previous
</Button>
<Button className="bg-gray-200 w-auto items-center" color="white-gray">
Next
<Icon.ChevronDoubleRightIcon className="w-6 h-4" />
</Button>
</div>
</div>
</div>
</main>
Expand Down
6 changes: 6 additions & 0 deletions packages/front/src/icons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import {
CalendarIcon,
ChartBarIcon,
ChevronDoubleLeftIcon,
ChevronDoubleRightIcon,
ChevronDownIcon,
DocumentAddIcon,
FolderAddIcon,
FolderIcon,
HomeIcon,
InboxIcon,
MenuIcon,
SearchIcon,
UsersIcon,
XIcon,
} from '@heroicons/react/outline';
Expand All @@ -32,6 +35,8 @@ export default {
Calendar: CalendarIcon,
ChartBart: ChartBarIcon,
Check: CheckIcon,
ChevronDoubleLeftIcon,
ChevronDoubleRightIcon,
ChevronDown: ChevronDownIcon,
Collection: CollectionIcon,
Cross: CrossIcon,
Expand All @@ -49,6 +54,7 @@ export default {
Logo: LogoIcon,
LogoLight: LogoLightIcon,
Menu: MenuIcon,
OutlineSearch: SearchIcon,
ProductHunt: ProductHuntIcon,
Share: ShareIcon,
Spinner: SpinnerIcon,
Expand Down