-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor files structure and add domains page query params
- Loading branch information
1 parent
2d723b5
commit c7a1465
Showing
36 changed files
with
327 additions
and
191 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/configs/clusters/clusters-configs.ts → src/config/clusters/clusters-config.ts
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
src/containers/domains-page/config/domains-page-filters-config.ts
This file contains 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,15 @@ | ||
import { DomainPageFilters } from "../domains-page-filters/domains-page-filters.types"; | ||
import DomainsPageFiltersClusterName from "../domains-page-filters-cluster-name/domains-page-filters-cluster-name"; | ||
|
||
const domainPageFilters = [ | ||
{ | ||
id: 'clusterName', | ||
renderFilter: DomainsPageFiltersClusterName, | ||
}, | ||
{ | ||
id: 'searchText', | ||
renderFilter: DomainsPageFiltersClusterName, | ||
} | ||
] as const satisfies DomainPageFilters; | ||
|
||
export default domainPageFilters; |
29 changes: 29 additions & 0 deletions
29
src/containers/domains-page/config/domains-page-query-params.ts
This file contains 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,29 @@ | ||
import { PageQueryParam } from "@/hooks/use-page-query-params/types" | ||
|
||
const domainPageQueryParamsConfig: | ||
[ | ||
PageQueryParam<"searchText", string>, | ||
PageQueryParam<"clusterName", string>, | ||
PageQueryParam<"sortColumn", string>, | ||
PageQueryParam<"sortOrder", string> | ||
] | ||
= [{ | ||
key: "searchText", | ||
queryParamKey: "s", | ||
defaultValue: "" | ||
}, | ||
{ | ||
key: "clusterName", | ||
queryParamKey: "c", | ||
defaultValue: "" | ||
}, | ||
{ | ||
key: "sortColumn", | ||
queryParamKey: "sc", | ||
}, | ||
{ | ||
key: "sortOrder", | ||
queryParamKey: "so", | ||
}] as const; | ||
|
||
export default domainPageQueryParamsConfig; |
2 changes: 1 addition & 1 deletion
2
...age/domains-table/domains-table.config.ts → ...ge/config/domains-table-columns-config.ts
This file contains 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
31 changes: 31 additions & 0 deletions
31
...omains-page/domains-page-filters-cluster-name/domains-page-filters-cluster-name.styles.ts
This file contains 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,31 @@ | ||
import type { StyletronCSSObject, StyletronCSSObjectOf } from "@/hooks/use-styletron-classes"; | ||
import { Theme } from "baseui"; | ||
import type { FormControlOverrides } from "baseui/form-control/types"; | ||
import { StyleObject } from "styletron-react"; | ||
|
||
export const overrides = { | ||
selectFormControl: { | ||
Label: { | ||
style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
...$theme.typography.LabelXSmall | ||
}) | ||
}, | ||
ControlContainer: { | ||
style: (): StyleObject => ({ | ||
margin: "0px" | ||
}) | ||
} | ||
} satisfies FormControlOverrides | ||
|
||
} | ||
|
||
|
||
const cssStylesObj = { | ||
selectFilterContainer: (theme) => ({ | ||
[theme.mediaQuery.medium]: { | ||
flex: "1", | ||
} | ||
}), | ||
} satisfies StyletronCSSObject; | ||
|
||
export const cssStyles: StyletronCSSObjectOf<typeof cssStylesObj> = cssStylesObj; |
31 changes: 31 additions & 0 deletions
31
...ners/domains-page/domains-page-filters-cluster-name/domains-page-filters-cluster-name.tsx
This file contains 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,31 @@ | ||
"use client"; | ||
import React from 'react'; | ||
import useStyletronClasses from '@/hooks/use-styletron-classes'; | ||
import { cssStyles, overrides } from './domains-page-filters-cluster-name.styles'; | ||
import { FormControl } from 'baseui/form-control'; | ||
import { Select } from 'baseui/select'; | ||
import CLUSTERS_CONFIGS from '@/config/clusters/clusters-config'; | ||
import { DomainPageFilterProps } from "../domains-page-filters/domains-page-filters.types"; | ||
|
||
const clustersOptions = CLUSTERS_CONFIGS.map(({ clusterName }) => ({ label: clusterName, id: clusterName })); | ||
|
||
function DomainsPageFiltersClusterName({ onChange, value }: DomainPageFilterProps) { | ||
const { cls } = useStyletronClasses(cssStyles); | ||
|
||
const clusterValue = clustersOptions.filter(({ id }) => id === value) | ||
|
||
return ( | ||
<div className={cls.selectFilterContainer}> | ||
<FormControl overrides={overrides.selectFormControl} label="Clusters"> | ||
<Select | ||
size="compact" | ||
value={clusterValue} | ||
options={clustersOptions} | ||
onChange={(params) => onChange(String(params.value[0]?.id))} | ||
/> | ||
</FormControl> | ||
</div> | ||
); | ||
} | ||
|
||
export default DomainsPageFiltersClusterName; |
This file contains 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 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
15 changes: 15 additions & 0 deletions
15
src/containers/domains-page/domains-page-filters/domains-page-filters.types.ts
This file contains 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,15 @@ | ||
import type { PageQueryParamKeys } from "@/hooks/use-page-query-params/types"; | ||
import domainPageQueryParamsConfig from "@/containers/domains-page/domains-page-query-params"; | ||
|
||
|
||
export type DomainPageFilterProps = { | ||
onChange: (v: string | string[] | undefined) => void, | ||
value: any, | ||
} | ||
|
||
export type DomainPageFilter = { | ||
id: PageQueryParamKeys<typeof domainPageQueryParamsConfig>; | ||
renderFilter: React.ComponentType<DomainPageFilterProps> | ((props: DomainPageFilterProps) => React.ReactNode); | ||
}; | ||
|
||
export type DomainPageFilters = Array<DomainPageFilter>; |
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/containers/domains-page/domains-page-title-badge/domains-page-title-badge.styles.ts
This file contains 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,18 @@ | ||
import type{ Theme } from "baseui"; | ||
import type { StyleObject } from "styletron-react"; | ||
import type { BadgeOverrides } from "baseui/badge"; | ||
|
||
export const overrides = { | ||
badge: { | ||
Badge: { | ||
style: ({ $theme }: { $theme: Theme }): StyleObject => ({ | ||
color: $theme.colors.contentPrimary, | ||
backgroundColor: $theme.colors.backgroundTertiary, | ||
borderRadius: '20px', | ||
padding: `${$theme.sizing.scale0} ${$theme.sizing.scale300}`, | ||
...$theme.typography.LabelXSmall | ||
}), | ||
}, | ||
} satisfies BadgeOverrides | ||
} | ||
|
This file contains 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
3 changes: 3 additions & 0 deletions
3
src/containers/domains-page/domains-page-title-badge/domains-page-title-badge.types.ts
This file contains 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,3 @@ | ||
export type Props = { | ||
content: string | number | ||
} |
6 changes: 1 addition & 5 deletions
6
src/containers/domains-page/domains-page-title/domains-page-title.tsx
This file contains 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
5 changes: 5 additions & 0 deletions
5
src/containers/domains-page/domains-page-title/domains-page-title.types.ts
This file contains 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,5 @@ | ||
import type { ReactNode } from "react" | ||
|
||
export type Props = { | ||
countBadge: ReactNode | ||
} |
This file contains 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 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
Oops, something went wrong.