-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from jpmorgan-payments/feature/embedded-compon…
…ents Add initial draft version of embedded components
- Loading branch information
Showing
131 changed files
with
57,000 additions
and
298 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,29 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Release EB Components to npm | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
defaults: | ||
run: | ||
working-directory: "./embedded-components" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
scope: "@jpmorgan-payments" | ||
- name: Build and package | ||
run: | | ||
yarn install --frozen-lockfile | ||
yarn run test | ||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_JPMC_PUBLISHER }} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
20 changes: 20 additions & 0 deletions
20
app/client/src/components/ComponentSamplePanel/ComponentSamplePanel.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,20 @@ | ||
import { Box, Grid } from '@mantine/core'; | ||
import { Prism } from '@mantine/prism'; | ||
|
||
type ComponentSamplePanelProps = { | ||
code: string; | ||
component: React.ReactNode; | ||
}; | ||
|
||
export const ComponentSamplePanel = ({ code, component }:ComponentSamplePanelProps) => { | ||
return ( | ||
<Grid align="center" justify="center" style={{ width: '100%' }}> | ||
<Grid.Col lg={8} sm={10}> | ||
<Box p="lg">{component}</Box> | ||
<Prism colorScheme="dark" language="javascript"> | ||
{code} | ||
</Prism> | ||
</Grid.Col> | ||
</Grid> | ||
); | ||
}; |
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
app/client/src/components/Layout/NavbarLinks/NavbarLinksComponentShowcase.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 @@ | ||
import { useMatch, useResolvedPath } from 'react-router-dom'; | ||
import { Button, Text, useMantineTheme } from '@mantine/core'; | ||
import { useWindowScroll } from '@mantine/hooks'; | ||
import useStyles from './NavbarLinks.styles'; | ||
|
||
const menu = [ | ||
{ | ||
label: 'Getting Started', | ||
items: [ | ||
{ | ||
label: 'Overview', | ||
}, | ||
{ | ||
label: 'Installation', | ||
}, | ||
{ | ||
label: 'Authentication Provider', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Components', | ||
items: [ | ||
{ | ||
label: 'Link Account', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
function getStartY(el: any) { | ||
const rect = el?.getBoundingClientRect(); | ||
return rect?.top + window.scrollY - 200; | ||
} | ||
|
||
function getEndY(startY: any, el: any) { | ||
const height = el?.offsetHeight; | ||
return height + startY; | ||
} | ||
|
||
const NavbarLink = ({ children, to, title }: any) => { | ||
const { classes, cx } = useStyles(); | ||
const resolved = useResolvedPath(to); | ||
const match = useMatch({ path: resolved.pathname }); | ||
const childMatch = useMatch({ path: resolved.pathname + '/:child' }); | ||
const [scroll, scrollTo] = useWindowScroll(); | ||
const theme = useMantineTheme(); | ||
const elM = document.getElementById(`${title?.trim()}-panel`); | ||
const startY = getStartY(elM); | ||
const endY = getEndY(startY, elM); | ||
|
||
return ( | ||
<Button | ||
style={{ | ||
width: '100%', | ||
backgroundColor: | ||
scroll.y >= startY && scroll.y < endY | ||
? theme.colors.gray[1] | ||
: 'white', | ||
}} | ||
className={cx(classes.link, { | ||
[classes.linkActive]: match || childMatch, | ||
})} | ||
onClick={() => scrollTo({ y: startY })} | ||
> | ||
{children} | ||
</Button> | ||
); | ||
}; | ||
|
||
export const NavbarLinksComponentShowcase = () => { | ||
const theme = useMantineTheme(); | ||
return ( | ||
<> | ||
{menu.map((section) => ( | ||
<div key={`navbar${section.label}`}> | ||
<Text mb={theme.spacing.sm} mt={theme.spacing.sm} weight={600}> | ||
{section?.label} | ||
</Text> | ||
{section?.items.map((item) => ( | ||
<NavbarLink key={`${item.label}`} title={item?.label}> | ||
<span>{item.label}</span> | ||
</NavbarLink> | ||
))} | ||
</div> | ||
))} | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.