Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reapit/foundations into r…
Browse files Browse the repository at this point in the history
…efactor/1891-apply-new-styles-and-containers-to-geo-diary-app
  • Loading branch information
Vu Nguyen committed Jul 6, 2020
2 parents d696b32 + bd66470 commit 2ab997b
Show file tree
Hide file tree
Showing 126 changed files with 2,914 additions and 1,192 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release-note-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: checks out repository to $GITHUB_WORKSPACE
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup NodeJS
uses: actions/setup-node@v1
Expand Down Expand Up @@ -48,6 +50,7 @@ jobs:
with:
repository: ${{ env.DOC_REPO }}
path: ${{ env.DOC_CLONE_PATH }}
fetch-depth: 0

- name: Run update doc script
run: |
Expand Down
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/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.
2 changes: 1 addition & 1 deletion packages/elements/src/components/DatePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const DatePicker = ({
const className = hasError ? 'input is-danger' : 'input is-primary'

return (
<div className="field pb-2">
<div className="field">
<div className="control">
{labelText && (
<label className={`label ${required ? 'required-label' : ''}`} htmlFor={id}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ exports[`Input should match a snapshot if field is required 1`] = `
</Field>
`;

exports[`Input should match a snapshot if helperText is a component 1`] = `
<Field
name="username"
validate={null}
>
<Component />
</Field>
`;

exports[`Input should match a snapshot with right icon 1`] = `
<Field
name="username"
Expand Down
12 changes: 12 additions & 0 deletions packages/elements/src/components/Input/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ const requiredInputProps: InputProps = {
required: true,
}

const helperTextComponentInputProps: InputProps = {
id: 'username',
name: 'username',
labelText: 'User name',
type: 'text',
helperText: <b>Helper text</b>,
}

describe('Input', () => {
it('should match a snapshot', () => {
expect(toJson(shallow(<Input {...props} />))).toMatchSnapshot()
Expand All @@ -43,6 +51,10 @@ describe('Input', () => {
expect(toJson(shallow(<Input {...requiredInputProps} />))).toMatchSnapshot()
})

it('should match a snapshot if helperText is a component', () => {
expect(toJson(shallow(<Input {...helperTextComponentInputProps} />))).toMatchSnapshot()
})

it('should work when integrating with Formik', async () => {
const wrapper = mount(
<Formik initialValues={{ username: '' }} onSubmit={jest.fn()}>
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface InputProps {
placeholder?: string
id: string
labelText?: string
helperText?: string
helperText?: React.ReactNode
name: string
dataTest?: string
rightIcon?: React.ReactNode
Expand Down Expand Up @@ -46,7 +46,7 @@ export const Input = ({
</label>
)}

{helperText && <p className="mb-3">{helperText}</p>}
{helperText && (React.isValidElement(helperText) ? helperText : <p className="mb-3">{helperText}</p>)}

<input
disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exports[`Modal should match a snapshot for ModalHeader 1`] = `
className="delete"
data-test="modal-close-button"
onClick={[Function]}
type="button"
/>
</header>
`;
1 change: 1 addition & 0 deletions packages/elements/src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const ModalHeader: React.SFC<ModalHeaderProps> = ({ title, afterClose })
className="delete"
aria-label="close"
data-test="modal-close-button"
type="button"
onClick={event => {
event.preventDefault()
afterClose && afterClose()
Expand Down
3 changes: 2 additions & 1 deletion packages/elements/src/styles/base/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ $layout-quadruple: calc(1rem * 4);
$layout-sextuple: calc(1rem * 6);

$menu-width: 250px;
$page-container: calc(100vw - 250px);
$nav-bar-width: 66px;
$page-container: calc(100vw - 250px);
4 changes: 4 additions & 0 deletions packages/elements/src/styles/base/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ $units: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
flex-grow: $unit;
}

.flex-shrink-#{$unit} {
flex-shrink: $unit;
}

.text-ellipsis-#{$unit} {
display: -webkit-box;
-webkit-line-clamp: 1;
Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/styles/components/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
& td {
word-break: normal;
max-width: 300px;
overflow-wrap: break-word;
}
tr {
&.is-expanded {
Expand Down
6 changes: 6 additions & 0 deletions packages/elements/src/styles/components/toast.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '../base/layout.scss';
@import '../base/browser.scss';

.toast {
width: 100%;
Expand All @@ -18,6 +19,11 @@
-webkit-transform: translateY(-$layout-base);
}

@include for-ie-only {
width: inherit;
left: $nav-bar-width;
}

button {
white-space: unset;
}
Expand Down
20 changes: 16 additions & 4 deletions packages/elements/src/styles/vendor/bulma-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ html {
}
}

.field, .field:not(:last-child) {
.field,
.field:not(:last-child) {
margin-bottom: 0.75rem;
}

Expand Down Expand Up @@ -168,9 +169,11 @@ html {
}

.control {
.label, i {
.label,
i {
color: $grey;
}

&.has-icons-right,
&.has-icons-left {
.icon {
Expand Down Expand Up @@ -284,19 +287,28 @@ a {
}

&.is-page-container {
// to allow scroll past end of content, allowing for toast popup and
// to allow scroll past end of content, allowing for toast popup and
// increase readability, especially in mobile
margin-bottom: 6rem;
// Need to use "padding-bottom" here because "margin-bottom" doesn't work on IE
padding-bottom: 6rem;
// Fix IE flex columns height bug
// https://stackoverflow.com/a/36900208
flex-shrink: 0;
}
}

.modal-card-title {
font-family: $title-family;
}

.modal-card {
overflow: auto;
}

.modal-card,
.modal-content {
margin: 0 auto;

.modal-card {
@media screen and (max-width: 768px) {
max-height: calc(100vh - 160px);
Expand Down
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-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.
2 changes: 1 addition & 1 deletion packages/elements/src/utils/validators/error-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const errorMessages = {
FIELD_INVALID_PASSWORD:
'Your Password should be a minimum of 8 characters; ' +
'must contain at least one lowercase letter, one uppercase letter and one number.',
FIELD_WRONG_URI_FORMAT: 'Invalid uri format',
FIELD_WRONG_URI_FORMAT: 'Invalid URI format',
MINIMUM_CHARACTER_LENGTH: minCharLengthErrMessage,
MAXIMUM_CHARACTER_LENGTH: maxCharLengthErrMessage,
}
Expand Down
Loading

0 comments on commit 2ab997b

Please sign in to comment.