Skip to content

Commit

Permalink
feat: #1033 configure my web component installations in the Marketpla…
Browse files Browse the repository at this point in the history
…ce (#1313)

* feat: #1033 configure my web component installations in the Marketplace

* chore: #1033 add negotiators dropdown

* chore: #1033 update app header, update snapshot

* chore: #1033 fetch negotiators list

* chore: #1033 update api

* chore: #1033 update follow PR cmts

* chore: #1033 fix test fail
  • Loading branch information
Trường An authored May 26, 2020
1 parent ef32917 commit 663bb21
Show file tree
Hide file tree
Showing 49 changed files with 2,521 additions and 47 deletions.
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Checkbox should match a snapshot 1`] = `
<div
className="field pb-4"
className="field pb-4 "
>
<div
className="control"
Expand Down
5 changes: 3 additions & 2 deletions packages/elements/src/components/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface CheckboxProps {
name: string
dataTest?: string
value?: string
className?: string
}

export type HandleCheckboxOnChangeParams = {
Expand All @@ -30,9 +31,9 @@ export const handleOnCheckboxChange = ({ field, value }: HandleCheckboxOnChangeP
return
}

export const Checkbox = ({ name, labelText, id, dataTest = '', value = '' }: CheckboxProps) => {
export const Checkbox = ({ name, labelText, id, dataTest = '', value = '', className = '' }: CheckboxProps) => {
return (
<div className="field pb-4">
<div className={`field pb-4 ${className}`}>
<div className="control">
<Field type="checkbox" name={name}>
{({ field }: FieldProps<string | string[]>) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/elements/src/components/DropdownSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface DropdownSelectProps extends SelectProps {
placeholder?: string
options: SelectOption[]
required?: boolean
subText?: string
}

export interface SelectOption {
Expand All @@ -29,6 +30,7 @@ export const DropdownSelect: React.FC<DropdownSelectProps> = ({
placeholder,
options,
required = false,
subText,
...restProps
}) => {
const handleRenderTags = (props: CustomTagProps) => {
Expand All @@ -54,6 +56,7 @@ export const DropdownSelect: React.FC<DropdownSelectProps> = ({
return (
<div className="field field-dropdown-select">
<label className={`label ${required ? 'required-label' : ''}`}>{labelText}</label>
{subText && <label className="subtext mb-2">{subText}</label>}
<Select
id={id}
placeholder={placeholder}
Expand Down
11 changes: 8 additions & 3 deletions packages/elements/src/components/RadioSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,43 @@ export type RadioSelectOption = {
export type RadioSelectProps = {
name: string
labelText?: string
subText?: string
id: string
dataTest?: string
options: RadioSelectOption[]
setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void
state: any
disabled?: boolean
className?: string
}

export const RadioSelect: React.FC<RadioSelectProps> = ({
name,
labelText,
subText,
id,
dataTest,
options,
setFieldValue,
state,
disabled = false,
className = '',
}) => {
return (
<Field type="radio" name={name}>
{({ meta }: FieldProps<string>) => {
const hasError = checkError(meta)
return (
<div className="field pb-2">
<div className={`field pb-2 ${className}`}>
<div className="control">
<label className="label" htmlFor={id}>
{labelText}
</label>
{subText && <label className="subtext mb-2">{subText}</label>}
{options.map(({ label, value }: RadioSelectOption, index: number) => (
<div key={index} data-test={dataTest} className="radio-wrap">
<input
id={label as string}
id={`${name}${label}`}
className={`checkbox ${hasError ? 'checkbox-error' : ''}`}
type="radio"
key={value}
Expand All @@ -51,7 +56,7 @@ export const RadioSelect: React.FC<RadioSelectProps> = ({
disabled={disabled}
onChange={() => setFieldValue(name, value)}
/>
<label htmlFor={label as string}>{label}</label>
<label htmlFor={`${name}${label}`}>{label}</label>
</div>
))}
</div>
Expand Down
15 changes: 13 additions & 2 deletions packages/elements/src/styles/components/checkbox.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import '../base/colors.scss';

.field {

.checkbox {
position: absolute;
width: 0;
Expand Down Expand Up @@ -79,7 +78,19 @@
margin-bottom: 4px;
}


.control {
.subtext {
font-style: italic;
display: block;
}
}

&.checkbox-inline {
.radio-wrap {
display: inline-block;
margin-right: 1rem;
}
}
}

.field-checkbox {
Expand Down
5 changes: 4 additions & 1 deletion packages/elements/src/styles/components/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
&.has-background {
background-color: $white;
}
}

&.flex-wrap {
flex-wrap: wrap;
}
}
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/elements/src/tests/badges/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions packages/marketplace/src/actions/__tests__/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import {
clientFetchAppSummarySuccess,
clientFetchAppSummaryFailed,
clientClearAppSummary,
clientOpenWebComponentConfig,
clientCloseWebComponentConfig,
clientFetchWebComponentConfig,
clientFetchWebComponentConfigSuccess,
clientPutWebComponentConfig,
clientFetchNegotiatorsSuccess,
} from '../client'
import ActionTypes from '../../constants/action-types'
import { appsDataStub, featuredAppsDataStub } from '../../sagas/__stubs__/apps'
Expand All @@ -29,4 +35,23 @@ describe('client actions', () => {
expect(clientClearAppSummary.type).toEqual(ActionTypes.CLIENT_CLEAR_APP_SUMMARY)
expect(clientClearAppSummary(null).data).toEqual(null)
})
it('should create a clientOpenWebComponentConfig action', () => {
expect(clientOpenWebComponentConfig.type).toEqual(ActionTypes.CLIENT_WEB_COMPONENT_CONFIG_OPEN)
})
it('should create a clientCloseWebComponentConfig action', () => {
expect(clientCloseWebComponentConfig.type).toEqual(ActionTypes.CLIENT_WEB_COMPONENT_CONFIG_CLOSE)
})
it('should create a clientFetchWebComponentConfig action', () => {
expect(clientFetchWebComponentConfig.type).toEqual(ActionTypes.CLIENT_FETCH_WEB_COMPONENT_CONFIG)
expect(clientFetchWebComponentConfig({ customerId: 'DXX' }).data).toEqual({ customerId: 'DXX' })
})
it('should create a clientFetchWebComponentConfigSuccess action', () => {
expect(clientFetchWebComponentConfigSuccess.type).toEqual(ActionTypes.CLIENT_FETCH_WEB_COMPONENT_CONFIG_SUCCESS)
})
it('should create a clientPutWebComponentConfig action', () => {
expect(clientPutWebComponentConfig.type).toEqual(ActionTypes.CLIENT_PUT_WEB_COMPONENT_CONFIG)
})
it('should create a clientPutWebComponentConfig action', () => {
expect(clientFetchNegotiatorsSuccess.type).toEqual(ActionTypes.CLIENT_FETCH_NEGOTIATORS_SUCCESS)
})
})
Loading

0 comments on commit 663bb21

Please sign in to comment.