Skip to content

Commit

Permalink
Merge branch 'main' into snyk-upgrade-608a3880f9b96d2131b6286ffd83adf6
Browse files Browse the repository at this point in the history
  • Loading branch information
will0684 authored Sep 20, 2023
2 parents ebf0729 + 805fdee commit 02da29a
Show file tree
Hide file tree
Showing 33 changed files with 1,613 additions and 1,566 deletions.
13 changes: 6 additions & 7 deletions AzurePipelines/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ steps:
az webapp deployment slot create \
--name $(webapp.name) \
--resource-group $(webapp.resourceGroup) \
--slot pr-preview-$(webapp.slotName) \
--configuration-source $(webapp.name)
--slot pr-preview-$(webapp.slotName)
az webapp identity assign \
-g $(webapp.resourceGroup) \
-n $(webapp.name) \
--slot pr-preview-$(webapp.slotName) \
--identities /subscriptions/19bddd49-8e73-4699-930d-74baa7e5751e/resourcegroups/AlphasiteAppserviceRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID-SCLabs-dev
- task: AzureCLI@2
displayName: 'Deploy pr image to new slot'
Expand All @@ -90,11 +94,6 @@ steps:
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az webapp identity assign \
-g $(webapp.resourceGroup) \
-n $(webapp.name) \
--slot pr-preview-$(webapp.slotName) \
--identities /subscriptions/19bddd49-8e73-4699-930d-74baa7e5751e/resourcegroups/AlphasiteAppserviceRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID-SCLabs-dev
az webapp config container set \
--docker-custom-image-name alphasitecrdev.azurecr.io/$(azureContainerRegistry.repository):$(azureContainerRegistry.tag) \
--name $(webapp.name) \
Expand Down
11 changes: 3 additions & 8 deletions components/atoms/ProjectInfo.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import PropTypes from "prop-types";
import { useTranslation } from "next-i18next";
import { useState } from "react";
import { HelpIcon } from "@dts-stn/service-canada-design-system";
import { HelpIcon } from "../design-system/HelpIcon";

export function ProjectInfo(props) {
const { t } = useTranslation("common");
const [showInfo, setShowInfo] = useState(false);

return (
<>
<div className="grid grid-cols-1 xl:grid-cols-3 gap-x-2 text-[20px]">
<strong className="font-body col-span-1">{props.termStarted}</strong>
<p className="col-span-2">
{!props.dateStarted ? undefined : props.dateStarted.substring(0, 10)}
{props.dateStarted && props.dateStarted.substring(0, 10)}
</p>
<strong className="font-body col-span-1">{props.termEnded}</strong>
<p className="col-span-2">
{!props.dateEnded ? undefined : props.dateEnded.substring(0, 10)}
{props.dateEnded && props.dateEnded.substring(0, 10)}
</p>
<strong className="font-body col-span-1 my-auto">
{props.termStage}
Expand Down
148 changes: 148 additions & 0 deletions components/design-system/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import PropTypes from "prop-types";
import { Image } from "./Image";

export function Button(props) {
const style = "btn-" + props.styling;
return props.href === "no ref" ? (
<button
className={`flex flex-row ${style} focus:ring focus:ring-offset-4 ${props.className} `}
onClick={props.onClick}
type={props.type}
id={props.id}
disabled={props.disabled}
{...props.attributes}
alt={props.iconAltText}
>
{props.icon && !props.iconEnd ? (
<span className="grid place-items-center h-8 w-8">
<Image className="pr-2" src={props.icon} alt={props.iconAltText} />
</span>
) : undefined}
{props.text}
{props.children}
{props.icon && props.iconEnd ? (
<span className="grid place-items-center h-8 w-8">
<Image className="pl-2" src={props.icon} alt={props.iconAltText} />
</span>
) : undefined}
</button>
) : (
<a
href={props.href}
className={`flex flex-row ${
props.styling !== "none" ? "btn-link" : ""
} focus:ring focus:ring-offset-4 ${props.className}`}
onClick={props.onClick}
id={props.id}
disabled={props.disabled}
role="button"
>
{props.icon && !props.iconEnd ? (
<Image
className="h-8 w-8 pr-2"
src={props.icon}
alt={props.iconAltText}
/>
) : undefined}
{props.text}
{props.children}
{props.icon && props.iconEnd ? (
<div className="grid place-items-center h-8 w-8">
<Image
className="pl-5 pb-3"
src={props.icon}
alt={props.iconAltText}
/>
</div>
) : undefined}
</a>
);
}

Button.defaultProps = {
id: "btn1",
styling: "supertask",
text: "default",
href: "no ref",
};

Button.propTypes = {
/**
* Identify which button being clicked
*/
id: PropTypes.string.isRequired,

/**
* User must input one of the follow button styles to apply
* to their button. To apply the link style, the user must
* also add a value to the href prop
*/
styling: PropTypes.oneOf([
"supertask",
"primary",
"secondary",
"danger",
"link",
"none",
]),

/**
* The text that the button will display
*/
text: PropTypes.string.isRequired,

/**
* This will add a img inside the button when needed
*/
icon: PropTypes.string,

/**
* Alt text for icon added to button
*/
iconAltText: PropTypes.string,

/**
* This is for placing an icon at the end of the component
*/
iconEnd: PropTypes.bool,

/**
* Use when button redirects to a new page.
* Automatically applies the Link styling
*/
href: PropTypes.string,

/**
* the type of the button
*/
type: PropTypes.oneOf(["submit", "reset", "button"]),

/**
* Callback for a click event on the button
*/
onClick: PropTypes.func,

/**
* bool to disable a button
*/
disabled: PropTypes.bool,

/**
* css overrides for button
*/
className: PropTypes.string,

/**
* additional attributes for button
*/
attributes: PropTypes.object,

/**
* any other elements you want to add to the button
*/
children: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
PropTypes.arrayOf(PropTypes.element),
]),
};
38 changes: 38 additions & 0 deletions components/design-system/CTA.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Button } from "./Button";
import { Link } from "./Link";
import { Image } from "./Image";

export function CTA({
heading,
body,
ButtonProps,
LinkProps,
containerClass = "",
}) {
return (
<div className="bg-multi-blue-blue2 p-3">
<div className={`flex flex-row ${containerClass}`}>
<div className="flex flex-col w-[60px] shrink-0">
<Image alt="icon" src="/comment_bubble.svg" className="w-[60px]" />
<div className="flex-grow divide-x-2 divide-multi-blue-blue60a flex flex-row justify-center mt-3">
<div></div>
<div></div>
</div>
</div>
<div className="pt-0 pl-5">
<h3 className={`leading-[40px] text-multi-neutrals-grey100`}>
{heading}
</h3>
<p className="body">{body}</p>
<Button
styling="primary"
className="my-3"
type="button"
{...ButtonProps}
/>
{LinkProps && <Link {...LinkProps} />}
</div>
</div>
</div>
);
}
52 changes: 52 additions & 0 deletions components/design-system/Collapse.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import PropTypes from "prop-types";

export function Collapse(props) {
const { id, title, children } = props;
return (
<details
key={id}
id={id}
className="mb-[5px] text-multi-neutrals-grey100 leading-[33px] text-mobileh5 font-body"
>
<summary
key={`summary-${id}`}
className="text-multi-blue-blue60d hover:hover:text-multi-blue-blue50b hover:underline border border-multi-neutrals-grey40 rounded px-[15px] py-[5px] cursor-pointer select-none outline-none"
>
{title}
</summary>
<div className="border border-multi-neutrals-grey40 rounded-b px-[18px] py-[5px] cursor-pointer select-none outline-none">
{children}
</div>
</details>
);
}

Collapse.defaultProps = {
id: "defaultAccordion",
};

Collapse.propTypes = {
/**
* component id
*/
id: PropTypes.string,

/**
* Title of the collapsible header
*/
title: PropTypes.string,

/**
* code passed in to fill the expanded area.
*/
children: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
PropTypes.arrayOf(PropTypes.element),
]),

/**
* Test id for unit test
*/
dataTestId: PropTypes.string,
};
Loading

0 comments on commit 02da29a

Please sign in to comment.