Skip to content

Commit

Permalink
groupByFirstLetter hook export updated
Browse files Browse the repository at this point in the history
  • Loading branch information
PunitSoniME committed Aug 2, 2024
1 parent f43e84a commit 1b01997
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion example/src/hooks/useGroupByFirstLetter/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const data = ["A", "AA", "B", "BB", "C", "CC", "D", "DD"].map((m, index) => {

export default function Demo() {

const { groupByFirstLetter } = useGroupByFirstLetter();
const groupByFirstLetter = useGroupByFirstLetter();
const groupByData = groupByFirstLetter(data, 'name') as any[];

return (
Expand Down
2 changes: 1 addition & 1 deletion example/src/hooks/useGroupByFirstLetter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const info = 'Group by your data by first letter';

const usage: string = `import { ${hook} } from '${packageName}';
const { groupByFirstLetter } = ${hook}();
const groupByFirstLetter = ${hook}();
const groupByData = groupByFirstLetter(DATA, PROPERTY_NAME_TO_GROUP);
/*
Expand Down
6 changes: 3 additions & 3 deletions example/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const ResizeObserverComponent = lazy(() => import('@/hooks/useResizeObserver'));
export const hooks = [
{ key: 'useToggle', version: '1.0.0', Component: ToggleComponent },
{ key: 'useTimeout', version: '1.0.0', Component: TimeoutComponent },
{ key: 'useDebounce', version: '1.5.0', Component: DebounceComponent },
{ key: 'useUpdateEffect', version: '1.0.0', Component: UpdateEffectComponent },
{ key: 'useArray', version: '1.0.0', Component: ArrayComponent },
{ key: 'usePrevious', version: '1.0.0', Component: PreviousComponent },
Expand All @@ -56,18 +55,19 @@ export const hooks = [
{ key: 'useEventListener', version: '1.2.0', Component: EventListenerComponent },
{ key: 'useIsAppOffline', version: '1.2.0', Component: IsAppOfflineComponent },
{ key: 'useWindowDimensions', version: '1.3.0', Component: WindowDimensionsComponent },
{ key: 'useDebounce', version: '1.5.0', Component: DebounceComponent },
{ key: 'useGeolocation', version: '1.5.0', Component: GeolocationComponent },
{ key: 'useAsyncLoop', version: '1.5.0', Component: AsyncLoopComponent },
{ key: 'useWindowFocus', version: '1.5.0', Component: WindowFocusComponent },
{ key: 'useSubdomain', version: '1.5.3', Component: SubdomainComponent },
{ key: 'useCopyToClipboard', version: '1.5.0', Component: CopyToClipboardComponent },
{ key: 'useSubdomain', version: '1.5.3', Component: SubdomainComponent },
{ key: 'useStateJson', version: '1.5.5', Component: StateJsonComponent },
{ key: 'useColorBlend', version: '1.6.0', Component: ColorBlendComponent },
{ key: 'useGroupByFirstLetter', version: '1.6.0', Component: GroupByFirstLetterComponent },
{ key: 'useScrollToTop', version: '1.7.0', Component: ScrollToTopComponent },
{ key: 'useSpeech', version: '1.10.1', Component: SpeechComponent },
{ key: 'useProvidersTree', version: '1.11.1', Component: ProvidersTreeComponent },
{ key: 'useHash', version: '1.10.1', Component: HashComponent },
{ key: 'useProvidersTree', version: '1.11.1', Component: ProvidersTreeComponent },
{ key: 'useClickOutside', version: '1.12.0', Component: ClickOutsideComponent, isNew: true },
{ key: 'useColorScheme', version: '1.12.0', Component: ColorSchemeComponent, isNew: true },
{ key: 'useElementSize', version: '1.12.0', Component: ElementSizeComponent, isNew: true },
Expand Down
2 changes: 1 addition & 1 deletion example/src/pages/LandingPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function LandingPage() {
</TableHeader>
<TableBody>
{
hooksList.map((hookDetail: any) => (
hooksList.filter((f: any) => f[1].length > 0).map((hookDetail: any) => (
<TableRow key={hookDetail[0]}>
<TableCell className="font-medium">
{hookDetail[0]}
Expand Down
4 changes: 2 additions & 2 deletions example/src/pages/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Layout() {
</Suspense>
</nav>

<div className="flex min-h-screen md:divide-x container px-0 md:px-4 mt-2">
<div className="flex min-h-screen md:divide-x container px-0">
<aside className="sticky top-16 h-[calc(100vh-theme(spacing.16))] w-[250px] hidden md:block">
<Suspense fallback={<></>}>
<Sidebar />
Expand All @@ -62,7 +62,7 @@ export default function Layout() {
</ScrollArea>
</SheetContent>

<main className="flex-1 mt-14 pr-4 overflow-x-auto">
<main className="flex-1 mt-14 overflow-x-auto">
{
hash ?
<Suspense fallback={<></>}>
Expand Down
13 changes: 4 additions & 9 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -873,15 +873,10 @@ camelcase-css@^2.0.1:
resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5"
integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==

caniuse-lite@^1.0.30001489:
version "1.0.30001502"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001502.tgz#f7e4a76eb1d2d585340f773767be1fefc118dca8"
integrity sha512-AZ+9tFXw1sS0o0jcpJQIXvFTOB/xGiQ4OQ2t98QX3NDn2EZTSRBC801gxrsGgViuq2ak/NLkNgSNEPtCr5lfKg==

caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001565:
version "1.0.30001574"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001574.tgz#fb4f1359c77f6af942510493672e1ec7ec80230c"
integrity sha512-BtYEK4r/iHt/txm81KBudCUcTy7t+s9emrIaHqjYurQ10x71zJ5VQ9x1dYPcz/b+pKSp4y/v1xSI67A+LzpNyg==
caniuse-lite@^1.0.30001489, caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001565:
version "1.0.30001646"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001646.tgz"
integrity sha512-dRg00gudiBDDTmUhClSdv3hqRfpbOnU28IpI1T6PBTLWa+kOj0681C8uML3PifYfREuBrVjDGhL3adYpBT6spw==

ccount@^2.0.0:
version "2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion src/useGroupByFirstLetter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export default function useGroupByFirstLetter() {
return Object.values(groupByData);
};

return { groupByFirstLetter };
return groupByFirstLetter;
}
9 changes: 7 additions & 2 deletions src/useHash/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';

type UseHashType = [

Check failure on line 3 in src/useHash/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 16.x and ubuntu-latest

Replace `⏎··hash:·string,⏎··updateHash:·(newHash:·any)·=>·void⏎` with `hash:·string,·updateHash:·(newHash:·any)·=>·void`

Check failure on line 3 in src/useHash/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 16.x and macOS-latest

Replace `⏎··hash:·string,⏎··updateHash:·(newHash:·any)·=>·void⏎` with `hash:·string,·updateHash:·(newHash:·any)·=>·void`

Check failure on line 3 in src/useHash/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

Replace `⏎··hash:·string,⏎··updateHash:·(newHash:·any)·=>·void⏎` with `hash:·string,·updateHash:·(newHash:·any)·=>·void`
hash: string,
updateHash: (newHash: any) => void
];

/**
* @since 1.10.1
*/
export default function useHash() {
const [hash, setHash] = React.useState(() => window.location.hash);
export default function useHash(): UseHashType {
const [hash, setHash] = React.useState<string>(() => window.location.hash);

const hashChangeHandler = React.useCallback(() => {
setHash(window.location.hash);
Expand Down

0 comments on commit 1b01997

Please sign in to comment.