Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: toolbar UI update with hoverable menu #1478

Merged
merged 25 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
47bd375
feat: preselect a tab in visualization options modal
HendrikThePendric May 24, 2023
95fa548
fix: stop using 0 as fallback value for a string prop
HendrikThePendric May 24, 2023
18cad6e
feat: add new toolbar components
HendrikThePendric May 24, 2023
50d2d14
feat: align file menu with new toolbar
HendrikThePendric May 24, 2023
0d94967
fix: export toolbar components
HendrikThePendric May 24, 2023
d25d4f5
chore: adjust imports so all are from @dhis2/ui
HendrikThePendric May 24, 2023
7971748
chore: update pot file
HendrikThePendric May 24, 2023
81787d0
chore: rename files
HendrikThePendric May 25, 2023
cd73b91
fix: adjust hover menu imports in file menu
HendrikThePendric May 30, 2023
b7482ae
fix: ensure toolbar does not grow past 32 height and includes border
HendrikThePendric May 30, 2023
2afb013
fix: ensure all new components accept dataTest with correct default
HendrikThePendric May 30, 2023
543d332
chore: add testing-library deps for popper asserting popper components
HendrikThePendric Jun 1, 2023
467c9b9
test: add unit test coverage for toolbar components
HendrikThePendric Jun 1, 2023
70f05c7
feat: add toolbar demo
HendrikThePendric Jun 1, 2023
be269dd
chore: fix capitalization issue
HendrikThePendric Jun 1, 2023
259a5bb
feat: add demo
HendrikThePendric Jun 5, 2023
a3e2d73
chore: fix incorrect error message
HendrikThePendric Jun 12, 2023
dd1244a
chore: fix filemenu demo story
HendrikThePendric Jun 12, 2023
9a29876
test: align file menu tests with new implementation
HendrikThePendric Jun 12, 2023
86e3aaf
chore: upgrade node version on CI
HendrikThePendric Jun 12, 2023
8e49ee2
chore: remove redundant mock
HendrikThePendric Jun 13, 2023
c9a5e73
chore: remove duplicated prop definitions
HendrikThePendric Jun 13, 2023
1061dc4
Merge branch 'master' into DHIS2-15167-toolbar-update
martinkrulltott Jun 16, 2023
ac75e1f
chore: rename story to Toolbar
HendrikThePendric Jun 19, 2023
dad114e
Merge branch 'master' into DHIS2-15167-toolbar-update
HendrikThePendric Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
token: ${{env.GH_TOKEN}}
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: Install
run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: Install
run: yarn install --frozen-lockfile
Expand Down
5 changes: 5 additions & 0 deletions config/setupTestingLibrary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { configure } from '@testing-library/dom'

configure({
testIdAttribute: 'data-test',
})
7 changes: 5 additions & 2 deletions 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: 2023-04-18T08:41:27.838Z\n"
"PO-Revision-Date: 2023-04-18T08:41:27.838Z\n"
"POT-Creation-Date: 2023-05-24T12:55:52.925Z\n"
"PO-Revision-Date: 2023-05-24T12:55:52.925Z\n"

msgid "view only"
msgstr "view only"
Expand Down Expand Up @@ -856,6 +856,9 @@ msgstr "Financial Years"
msgid "Years"
msgstr "Years"

msgid "Interpretations and details"
msgstr "Interpretations and details"

msgid "Translating to"
msgstr "Translating to"

Expand Down
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
testPathIgnorePatterns: ['/node_modules/', '/build/'],
setupFilesAfterEnv: ['<rootDir>/config/setupEnzyme.js'],
setupFilesAfterEnv: [
'<rootDir>/config/setupEnzyme.js',
'<rootDir>/config/setupTestingLibrary.js',
],
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"@storybook/addons": "^6.5.9",
"@storybook/preset-create-react-app": "^3.1.7",
"@storybook/react": "^6.1.14",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.15.6",
"fs-extra": "^10.1.0",
Expand Down
29 changes: 18 additions & 11 deletions src/__demo__/FileMenu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Provider } from '@dhis2/app-runtime'
import { storiesOf } from '@storybook/react'
import React from 'react'
import { FileMenu } from '../components/FileMenu/FileMenu.js'
import { HoverMenuBar } from '../components/Toolbar/index.js'

const configMock = {
baseUrl: 'http://localhost:8080',
Expand Down Expand Up @@ -61,24 +62,30 @@ const visReadonlyObject = {
storiesOf('FileMenu', module)
.add('Simple', () => (
<Provider config={configMock}>
<FileMenu currentUser={user} fileType="visualization" />
<HoverMenuBar>
<FileMenu currentUser={user} fileType="visualization" />
</HoverMenuBar>
</Provider>
))
.add('With AO', () => (
<Provider config={configMock}>
<FileMenu
currentUser={user}
fileType="visualization"
fileObject={visObject}
/>
<HoverMenuBar>
<FileMenu
currentUser={user}
fileType="visualization"
fileObject={visObject}
/>
</HoverMenuBar>
</Provider>
))
.add('With readonly AO', () => (
<Provider config={configMock}>
<FileMenu
currentUser={user}
fileType="visualization"
fileObject={visReadonlyObject}
/>
<HoverMenuBar>
<FileMenu
currentUser={user}
fileType="visualization"
fileObject={visReadonlyObject}
/>
</HoverMenuBar>
</Provider>
))
78 changes: 78 additions & 0 deletions src/__demo__/Toolbar.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { storiesOf } from '@storybook/react'
import React, { useState } from 'react'
import {
HoverMenuBar,
HoverMenuDropdown,
HoverMenuList,
HoverMenuListItem,
InterpretationsAndDetailsToggler,
Toolbar,
ToolbarSidebar,
UpdateButton,
} from '../components/Toolbar/index.js'

function ToolbarWithState() {
const [isHidden, setIsHidden] = useState(false)
const [isSidebarShowing, setIsSidebarShowing] = useState(false)
return (
<Toolbar>
<ToolbarSidebar isHidden={isHidden}>
<span>Toolbar side bar</span>
<a
style={{
paddingLeft: 12,
textDecoration: 'underline',
cursor: 'pointer',
}}
onClick={() => setIsHidden(true)}
>
click to hide
</a>
</ToolbarSidebar>
<UpdateButton />
<HoverMenuBar>
<HoverMenuDropdown label="Menu A">
<HoverMenuList>
<HoverMenuListItem label="Menu item A.1" />
<HoverMenuListItem label="Menu item A.2" />
<HoverMenuListItem label="Menu item A.3" />
</HoverMenuList>
</HoverMenuDropdown>
<HoverMenuDropdown label="Menu B">
<HoverMenuList>
<HoverMenuListItem label="Menu item B.1">
<HoverMenuListItem label="Menu item B.1.1" />
<HoverMenuListItem label="Menu item B.1.2" />
<HoverMenuListItem label="Menu item B.1.3" />
</HoverMenuListItem>
<HoverMenuListItem label="Menu item B.2">
<HoverMenuListItem label="Menu item B.2.1" />
<HoverMenuListItem label="Menu item B.2.2" />
<HoverMenuListItem label="Menu item B.2.3" />
</HoverMenuListItem>
<HoverMenuListItem label="Menu item B.3" disabled>
<HoverMenuListItem label="Menu item B.3.1" />
<HoverMenuListItem label="Menu item B.3.2" />
<HoverMenuListItem label="Menu item B.3.3" />
</HoverMenuListItem>
</HoverMenuList>
</HoverMenuDropdown>
<HoverMenuDropdown label="Menu C" disabled>
<HoverMenuList>
<HoverMenuListItem label="Menu item C.1" />
<HoverMenuListItem label="Menu item C.2" />
<HoverMenuListItem label="Menu item C.3" />
</HoverMenuList>
</HoverMenuDropdown>
</HoverMenuBar>
<InterpretationsAndDetailsToggler
isShowing={isSidebarShowing}
onClick={() => setIsSidebarShowing((current) => !current)}
/>
</Toolbar>
)
}

storiesOf('Toolbar', module).add('default', () => {
return <ToolbarWithState />
})
Loading