-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/CPLP-3576/StepperUpdates
- Loading branch information
Showing
13 changed files
with
419 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# ############################################################################# | ||
# Copyright (c) 2023 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# ############################################################################# | ||
|
||
name: "Lint PullRequest" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: marocchino/sticky-pull-request-comment@v2 | ||
# When the previous steps fail, the workflow would stop. By adding this | ||
# condition you can continue the execution with the populated error message. | ||
if: always() && (steps.lint_pr_title.outputs.error_message != null) | ||
with: | ||
header: pr-title-lint-error | ||
message: | | ||
Hey there and thank you for opening this pull request! 👋🏼 | ||
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. | ||
Details: | ||
``` | ||
${{ steps.lint_pr_title.outputs.error_message }} | ||
``` | ||
# Delete a previous comment when the issue has been resolved | ||
- if: ${{ steps.lint_pr_title.outputs.error_message == null }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: pr-title-lint-error | ||
delete: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/components/basic/NewSubNavigation/NewSubNavigation.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
import { ComponentStory } from '@storybook/react' | ||
import { NewSubNavigation as Component } from '.' | ||
|
||
export default { | ||
title: 'Navigation', | ||
component: Component, | ||
argTypes: {}, | ||
} | ||
|
||
const Template: ComponentStory<typeof Component> = (args: any) => ( | ||
<Component {...args} /> | ||
) | ||
|
||
export const NewSubNavigation = Template.bind({}) | ||
NewSubNavigation.args = { | ||
title: 'Sub Menu', | ||
navigationArray: [ | ||
{ | ||
index: 1, | ||
title: 'Introduction', | ||
navigation: 'intro-id', | ||
}, | ||
{ | ||
index: 2, | ||
title: 'Core Values', | ||
navigation: 'core-id', | ||
}, | ||
{ | ||
index: 3, | ||
title: 'Benefits', | ||
navigation: 'advantage-id', | ||
}, | ||
{ | ||
index: 4, | ||
title: 'Terminology', | ||
navigation: 'terminology-id', | ||
}, | ||
{ | ||
index: 5, | ||
title: 'Data models', | ||
navigation: 'data-model-id', | ||
}, | ||
{ | ||
index: 6, | ||
title: 'Data exchange', | ||
navigation: 'data-exchange-id', | ||
}, | ||
{ | ||
index: 7, | ||
title: 'Connectivity-Portfolio', | ||
navigation: 'connection-id', | ||
}, | ||
{ | ||
index: 8, | ||
title: 'Business Applications', | ||
navigation: 'application-id', | ||
}, | ||
], | ||
buttonArray: [ | ||
{ | ||
buttonLabel: 'Button1', | ||
onButtonClick: () => console.log('Button1'), | ||
}, | ||
{ | ||
buttonLabel: 'Button1', | ||
onButtonClick: () => console.log('Button1'), | ||
}, | ||
], | ||
onClick: () => console.log('on navigation link click'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
import { Button } from '../Button' | ||
import EastIcon from '@mui/icons-material/East' | ||
import MoreVertIcon from '@mui/icons-material/MoreVert' | ||
import { Box, Divider } from '@mui/material' | ||
import { useState } from 'react' | ||
import { Typography } from '../Typography' | ||
import './styles.scss' | ||
|
||
export interface NavigationItem { | ||
index: number | ||
title: string | ||
navigation: string | ||
} | ||
|
||
export interface NavigationButton { | ||
buttonLabel: string | ||
onButtonClick: React.MouseEventHandler | ||
} | ||
|
||
export const NewSubNavigation = ({ | ||
title = 'Contents', | ||
navigationArray, | ||
buttonArray = [], | ||
onClick, | ||
updateHeaderTitle = false, | ||
}: { | ||
title?: string | ||
navigationArray: NavigationItem[] | ||
buttonArray?: NavigationButton[] | ||
onClick: (navigation: string) => void | ||
updateHeaderTitle?: boolean | ||
}): JSX.Element => { | ||
const [show, setShow] = useState(false) | ||
const [header, setHeader] = useState(title) | ||
const [highlight, setHighlight] = useState('') | ||
return ( | ||
<Box onMouseOver={() => { setShow(true) }}> | ||
{navigationArray?.length > 0 && ( | ||
<Box | ||
className="navigationParentContainer" | ||
onMouseLeave={() => { setShow(false) }} | ||
> | ||
<Box className="navigationContainer"> | ||
<Box className="navigationOverlayContainer"> | ||
<MoreVertIcon /> | ||
<Typography | ||
variant="h4" | ||
sx={{ | ||
marginLeft: '10px', | ||
fontSize: '14px', | ||
color: '#0f71cb', | ||
}} | ||
> | ||
{header} | ||
</Typography> | ||
{show && ( | ||
<Box className="navigationOverlay"> | ||
{navigationArray?.map((link: NavigationItem) => { | ||
return ( | ||
<Box | ||
key={link.index} | ||
onClick={() => { | ||
onClick(link.navigation) | ||
setShow(!show) | ||
if (updateHeaderTitle) { | ||
setHeader(link.title) | ||
} | ||
}} | ||
className="navigationOverlayItem" | ||
onMouseOut={() => { setHighlight(link.title) }} | ||
onMouseOver={() => { | ||
// do nothing | ||
}} | ||
sx={{ | ||
backgroundColor: | ||
header === link.title || highlight === link.title | ||
? 'rgba(15, 113, 203, 0.05)' | ||
: 'transparent', | ||
}} | ||
> | ||
<EastIcon | ||
sx={{ | ||
marginRight: '16px', | ||
fontSize: '18px', | ||
color: | ||
header === link.title || highlight === link.title | ||
? '#0f71cb' | ||
: '#EAF1FE', | ||
}} | ||
/> | ||
<Typography | ||
variant="h4" | ||
sx={{ | ||
color: | ||
header === link.title || highlight === link.title | ||
? '#111111' | ||
: '#888888', | ||
fontSize: '14px', | ||
}} | ||
> | ||
{link.title} | ||
</Typography> | ||
</Box> | ||
) | ||
})} | ||
{buttonArray?.length > 1 && ( | ||
<Divider | ||
sx={{ | ||
margin: '10px 0px', | ||
borderWidth: '1px', | ||
width: '100%', | ||
}} | ||
/> | ||
)} | ||
{buttonArray?.length > 1 && | ||
buttonArray?.map((btn: NavigationButton) => { | ||
return ( | ||
<Button | ||
key={btn.buttonLabel} | ||
onClick={(e) => { | ||
btn.onButtonClick(e) | ||
setShow(!show) | ||
}} | ||
color="secondary" | ||
variant="outlined" | ||
size="small" | ||
sx={{ | ||
marginTop: '10px', | ||
}} | ||
> | ||
{btn.buttonLabel} | ||
</Button> | ||
) | ||
})} | ||
</Box> | ||
)} | ||
</Box> | ||
{buttonArray?.length === 1 && ( | ||
<Button | ||
onClick={(e) => { | ||
buttonArray[0].onButtonClick(e) | ||
setShow(!show) | ||
}} | ||
color="secondary" | ||
variant="outlined" | ||
size="small" | ||
sx={{ | ||
marginTop: '10px', | ||
}} | ||
> | ||
{buttonArray[0].buttonLabel} | ||
</Button> | ||
)} | ||
</Box> | ||
</Box> | ||
)} | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.