Skip to content

Commit

Permalink
Merge pull request #1560 from dhis2/update-storybook
Browse files Browse the repository at this point in the history
chore: update storybook
  • Loading branch information
Mohammer5 authored Jul 30, 2024
2 parents 8a42991 + 6119271 commit 330d11b
Show file tree
Hide file tree
Showing 437 changed files with 13,202 additions and 11,339 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-deploy-netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile

- run: yarn build:legacy
- run: yarn build

- uses: nwtgck/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile

- run: yarn build:legacy
- run: yarn build

- name: Deploy
id: netlify-deploy
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/dhis2-verify-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
NODE_OPTIONS=--openssl-legacy-provider yarn setup
- name: Build
run: yarn build:legacy
run: yarn build

- run: ./scripts/create-artifact.sh

Expand Down Expand Up @@ -147,7 +147,8 @@ jobs:
- name: End-to-End tests
uses: cypress-io/github-action@v6
with:
start: 'yarn cy:start:legacy'
# This should be a command that starts the server to test against.
start: 'yarn cy:start'
wait-on: 'http://localhost:5000'
wait-on-timeout: 300
record: ${{ env.SHOULD_RECORD }}
Expand Down Expand Up @@ -185,9 +186,6 @@ jobs:
# ensure that d2-app-scripts is available
- run: yarn install --frozen-lockfile

# FIXME: Add legacy npm to allow our broken peerdeps for now.
# This should be addressed properly by fixing our peerdeps.
- run: npm i -g npm@6
- uses: dhis2/action-semantic-release@master
with:
publish-npm: true
Expand Down
4 changes: 2 additions & 2 deletions collections/forms/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-04-18T04:00:14.144Z\n"
"PO-Revision-Date: 2024-04-18T04:00:14.144Z\n"
"POT-Creation-Date: 2024-07-17T14:10:05.852Z\n"
"PO-Revision-Date: 2024-07-17T14:10:05.853Z\n"

msgid "Upload file"
msgstr "Upload file"
Expand Down
6 changes: 3 additions & 3 deletions collections/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"access": "public"
},
"scripts": {
"start": "start-storybook -c ../../storybook/config --port 5000",
"start": "storybook dev -c ../../storybook/config --port 5000",
"build": "d2-app-scripts build"
},
"peerDependencies": {
"react": "^16.8",
"react-dom": "^16.8"
"react": "^16.13",
"react-dom": "^16.13"
},
"dependencies": {
"@dhis2/prop-types": "^3.1.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react'
import { Field } from 'react-final-form'
import { formDecorator } from '../formDecorator.js'
import { hasValue } from '../validators/index.js'
import { CheckboxFieldFF } from './CheckboxFieldFF.js'

// https://github.com/final-form/react-final-form-arrays/issues/111
const initialValue = ['yes']

export default { title: 'Testing:Checkbox', decorators: [formDecorator] }
export const Unchecked = () => (
<Field
type="checkbox"
component={CheckboxFieldFF}
className="checkbox"
name="checkbox"
label="Label text"
validate={hasValue}
required
/>
)
export const Checked = () => (
<Field
type="checkbox"
component={CheckboxFieldFF}
className="checkbox"
name="checkbox"
label="Label text"
initialValue={true}
/>
)
export const UncheckedWithValue = () => (
<Field
type="checkbox"
component={CheckboxFieldFF}
className="checkbox"
name="checkbox"
label="Label text"
value="yes"
/>
)
export const CheckedWithValue = () => (
<Field
type="checkbox"
component={CheckboxFieldFF}
className="checkbox"
name="checkbox"
label="Label text"
value="yes"
initialValue={initialValue}
/>
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/react'
import React from 'react'
import { Field } from 'react-final-form'
import { CheckboxFieldFF } from '../CheckboxFieldFF/CheckboxFieldFF.js'
Expand All @@ -13,7 +12,7 @@ import { TextAreaFieldFF } from '../TextAreaFieldFF/TextAreaFieldFF.js'
import { composeValidators, email, hasValue } from '../validators/index.js'
import { FileInputFieldFF } from './FileInputFieldFF.js'

const StandardForm = ({ values }) => {
const Form = ({ values }) => {
return (
<div style={{ maxWidth: 830 }}>
<Field
Expand Down Expand Up @@ -262,9 +261,12 @@ const StandardForm = ({ values }) => {
)
}

storiesOf('Testing:FileInput', module)
.addDecorator(formDecorator)
.addParameters({ options: { showPanel: false } })
.add('Standard form', (_, { formRenderProps }) => (
<StandardForm {...formRenderProps} />
))
export default {
title: 'Testing:FileInput',
decorators: [formDecorator],
parameters: { options: { showPanel: false } },
}

export const StandardForm = (_, { formRenderProps }) => (
<Form {...formRenderProps} />
)
19 changes: 19 additions & 0 deletions collections/forms/src/InputFieldFF/InputFieldFF.e2e.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { Field } from 'react-final-form'
import { formDecorator } from '../formDecorator.js'
import { hasValue } from '../validators/index.js'
import { InputFieldFF } from './InputFieldFF.js'

export default { title: 'Testing:InputFieldFF', decorators: [formDecorator] }
export const Default = () => (
<Field component={InputFieldFF} name="agree" label="Do you agree?" />
)
export const Required = () => (
<Field
name="agree"
component={InputFieldFF}
required
validate={hasValue}
label="Do you agree?"
/>
)
21 changes: 0 additions & 21 deletions collections/forms/src/InputFieldFF/InputFieldFF.stories.e2e.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import { Field } from 'react-final-form'
import { formDecorator } from '../formDecorator.js'
import { hasValue } from '../validators/index.js'
import { MultiSelectFieldFF } from './MultiSelectFieldFF.js'

const defaultOptions = [
{ value: 'first', label: 'First' },
{ value: 'second', label: 'Second' },
]

export default {
title: 'MultiSelectFieldFF',
component: MultiSelectFieldFF,
decorators: [formDecorator],
}

export const Required = (_, { cypressProps }) => (
<Field
required
name="multiSelect"
label="Multi select"
component={MultiSelectFieldFF}
validate={hasValue}
options={cypressProps.options || defaultOptions}
/>
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Given } from '@badeball/cypress-cucumber-preprocessor'

Given('a required MultiSelect with no selected value', () => {
cy.visitStory('Testing:MultiSelectFieldFF', 'Required')
cy.visitStory('MultiSelectFieldFF', 'Required')
cy.getFormValue('multiSelect')
cy.verifyFormValue('multiSelect', undefined)
})
39 changes: 39 additions & 0 deletions collections/forms/src/RadioFieldFF/RadioFieldFF.e2e.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react'
import { Field } from 'react-final-form'
import { FieldGroupFF } from '../FieldGroupFF/FieldGroupFF.js'
import { formDecorator } from '../formDecorator.js'
import { hasValue } from '../validators/index.js'
import { RadioFieldFF } from './RadioFieldFF.js'

export default { title: 'Testing:RadioFieldFF', decorators: [formDecorator] }
export const RequiredAndNoSelectedValue = () => (
<FieldGroupFF name="choice">
<Field
type="radio"
component={RadioFieldFF}
name="choice"
label="One"
value="one"
validate={hasValue}
required
/>
<Field
type="radio"
component={RadioFieldFF}
name="choice"
label="Two"
value="two"
validate={hasValue}
required
/>
<Field
type="radio"
component={RadioFieldFF}
name="choice"
label="Three"
value="three"
validate={hasValue}
required
/>
</FieldGroupFF>
)
Loading

0 comments on commit 330d11b

Please sign in to comment.