-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pci-object-storage): add container step 1 & 2
ref: DTCORE-2884 Signed-off-by: Florian Renaut <[email protected]>
- Loading branch information
Showing
17 changed files
with
960 additions
and
19 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
12 changes: 12 additions & 0 deletions
12
packages/manager/apps/pci-object-storage/src/hooks/useColumnsCount.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,12 @@ | ||
import { useMemo } from 'react'; | ||
import { useWindowSize } from 'react-use'; | ||
|
||
export const useColumnsCount = (): 1 | 2 | 3 => { | ||
const { width: windowWidth } = useWindowSize(); | ||
return useMemo(() => { | ||
if (windowWidth >= 1200) return 3; | ||
if (windowWidth >= 768) return 2; | ||
|
||
return 1; | ||
}, [windowWidth]); | ||
}; |
95 changes: 95 additions & 0 deletions
95
packages/manager/apps/pci-object-storage/src/pages/objects/container/new/New.page.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,95 @@ | ||
import { useProject } from '@ovh-ux/manager-pci-common'; | ||
import { Headers, useProjectUrl } from '@ovh-ux/manager-react-components'; | ||
import { | ||
ODS_ICON_NAME, | ||
ODS_ICON_SIZE, | ||
ODS_TEXT_LEVEL, | ||
ODS_TEXT_SIZE, | ||
} from '@ovhcloud/ods-components'; | ||
import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core'; | ||
import { | ||
OsdsBreadcrumb, | ||
OsdsIcon, | ||
OsdsLink, | ||
OsdsText, | ||
} from '@ovhcloud/ods-components/react'; | ||
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useContext } from 'react'; | ||
import { ShellContext } from '@ovh-ux/manager-react-shell-client'; | ||
import { | ||
OBJECT_CONTAINER_OFFER_STORAGE_STANDARD, | ||
STORAGE_PRICES_LINK, | ||
} from '@/constants'; | ||
import { SolutionStepComponent } from './step/SolutionStep.component'; | ||
import { DeploymentModeStep } from './step/DeploymentModeStep.component'; | ||
import { useContainerCreationStore } from './useContainerCreationStore'; | ||
|
||
export default function ContainerNewPage() { | ||
const { t } = useTranslation('containers/add'); | ||
const projectHref = useProjectUrl('public-cloud'); | ||
const { data: project } = useProject(); | ||
const context = useContext(ShellContext); | ||
const { ovhSubsidiary } = context.environment.getUser(); | ||
const pricesLink = | ||
STORAGE_PRICES_LINK[ovhSubsidiary] || STORAGE_PRICES_LINK.DEFAULT; | ||
const { form } = useContainerCreationStore(); | ||
return ( | ||
<> | ||
<OsdsBreadcrumb | ||
items={[ | ||
{ | ||
href: projectHref, | ||
label: project?.description, | ||
}, | ||
{ | ||
label: t('pci_projects_project_storages_containers_add_title'), | ||
}, | ||
]} | ||
/> | ||
|
||
<div className="header mt-8"> | ||
<Headers | ||
title={t('pci_projects_project_storages_containers_add_title')} | ||
/> | ||
</div> | ||
|
||
<OsdsText | ||
size={ODS_TEXT_SIZE._400} | ||
level={ODS_TEXT_LEVEL.body} | ||
color={ODS_THEME_COLOR_INTENT.text} | ||
> | ||
{t('pci_projects_project_storages_containers_add_description')} | ||
</OsdsText> | ||
<br /> | ||
<OsdsLink | ||
className="mt-4" | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
href={pricesLink} | ||
target={OdsHTMLAnchorElementTarget._blank} | ||
> | ||
{t('pci_projects_project_storages_containers_add_description_link')} | ||
<span slot="end"> | ||
<OsdsIcon | ||
aria-hidden="true" | ||
className="ml-4" | ||
name={ODS_ICON_NAME.EXTERNAL_LINK} | ||
hoverable | ||
size={ODS_ICON_SIZE.xxs} | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
/> | ||
</span> | ||
</OsdsLink> | ||
{ | ||
// @TODO remove debugging data | ||
<pre>FORM DATA: {JSON.stringify(form)}</pre> | ||
} | ||
<div className="mt-6"> | ||
<SolutionStepComponent /> | ||
{form.offer === OBJECT_CONTAINER_OFFER_STORAGE_STANDARD && ( | ||
<DeploymentModeStep /> | ||
)} | ||
</div> | ||
</> | ||
); | ||
} |
Oops, something went wrong.