8000 Figma Code Connect by calebnance · Pull Request #345 · eBay/ebayui-core-react · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.

Figma Code Connect #345

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7c9b4e2
feat: adding code connect base
calebnance May 16, 2024
0987ec2
first go at figma.config for code connect
calebnance May 17, 2024
6e034c4
added example files for component mapping
calebnance May 17, 2024
10bcad1
starting to connect figma ds props with react component props
calebnance May 17, 2024
976b342
added more mappings
calebnance May 17, 2024
74ebd3f
fixed typos and spacing issues i found in readme
calebnance May 17, 2024
c1c68d2
added checkbox, radio, and switch
calebnance May 20, 2024
7368608
ts-ignore for code connect files
calebnance May 20, 2024
765b8dd
added required prop to Alert Dialog
calebnance May 20, 2024
c926b2b
fixed page notice issue
calebnance May 20, 2024
265fe37
fixes markdown issue
calebnance May 20, 2024
f836072
added more mappings
calebnance May 20, 2024
e3f5a75
added Tourtip and Video mapping
calebnance May 21, 2024
15bb3f6
added more components and variant overrides
calebnance May 21, 2024
3cced0d
added section-title and signal with variants
calebnance May 21, 2024
a3c63d1
added pagination and progress-stepper
calebnance May 21, 2024
fc5b605
no longer needed
calebnance May 21, 2024
1a227e1
updated button mappings
calebnance May 21, 2024
5f42779
added publish/unpublish script for Figma Code Connect
calebnance May 22, 2024
acba902
Merge branch 'main' into cn-code-connect
darkwebdev May 27, 2024
fce104c
added code connect docs
calebnance Sep 5, 2024
34ff1e2
updated readme
calebnance Sep 5, 2024
91d6636
updated readme
calebnance Sep 5, 2024
be46f22
fixes the naming issues
calebnance Mar 6, 2025
47ba8ff
merged latest
calebnance Mar 6, 2025
91abb75
updated lint issues
calebnance Mar 6, 2025
cc7afe0
updated yarn
calebnance Mar 6, 2025
11e1f9a
Merge branch 'main' into cn-code-connect
HenriqueLimas Mar 6, 2025
3dc568f
new mappings
calebnance Mar 10, 2025
956b54b
fixed section title
calebnance Mar 10, 2025
561758e
updated figma file
calebnance Mar 10, 2025
5eb6ee0
Merge branch 'main' into cn-code-connect
HenriqueLimas Mar 24, 2025
2128a90
cleaned up figma links
calebnance Mar 24, 2025
c888890
Merge remote-tracking branch 'upstream/main' into cn-code-connect
calebnance Apr 23, 2025
c6c07c8
move into tests directories
calebnance Apr 23, 2025
4c34e87
remove code connect from main readme
calebnance Apr 23, 2025
1df1ebf
updated pathings
calebnance Apr 23, 2025
1e823ed
replacement pathing wasn't working
calebnance Apr 23, 2025
8db66d9
updated ignore list
calebnance Apr 29, 2025
68154bc
upgraded package
calebnance Apr 29, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ junit.xml
coverage
/.vscode
/storybook-static
.env
18 changes: 18 additions & 0 deletions CODE_CONNECT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Figma Code Connect

**Publishing**

```
npx figma connect publish --token <token>
```

**Unpublishing**

```
npx figma connect unpublish --token <token>
```

**Helpful links:**

- [React docs](https://github.com/figma/code-connect/blob/main/cli/README.md)
- [Icon linking](https://www.figma.com/code-connect-docs/react/#connecting-icons)
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ Example of usage:
<EbayButton id="my-button" />
```

### Issues
## Issues

Create an issue on github
Create an [issue](/issues) on github

## [Contributing](CONTRIBUTING.md)
## Contributing

View [contributing docs](CONTRIBUTING.md)

## Changelog

Expand Down
35 changes: 35 additions & 0 deletions figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"codeConnect": {
"include": ["src/**/*.figma.tsx", "src/**/*.tsx"],
"exclude": ["test/**", "docs/**", "build/**"],

"react": {
"importPaths": {
"src/ebay-accordion/__tests__/*": "@ebay/ui-core-react/ebay-accordion",
"src/ebay-alert-dialog/__tests__/*": "@ebay/ui-core-react/ebay-alert-dialog",
"src/ebay-badge/__tests__/*": "@ebay/ui-core-react/ebay-badge",
"src/ebay-breadcrumbs/__tests__/*": "@ebay/ui-core-react/ebay-breadcrumbs",
"src/ebay-button/__tests__/*": "@ebay/ui-core-react/ebay-button",
"src/ebay-calendar/__tests__/*": "@ebay/ui-core-react/ebay-calendar",
"src/ebay-carousel/__tests__/*": "@ebay/ui-core-react/ebay-carousel",
"src/ebay-icon-button/__tests__/*": "@ebay/ui-core-react/ebay-icon-button",
"src/ebay-page-notice/__tests__/*": "@ebay/ui-core-react/ebay-page-notice",
"src/ebay-pagination/__tests__/*": "@ebay/ui-core-react/ebay-pagination",
"src/ebay-progress-stepper/__tests__/*": "@ebay/ui-core-react/ebay-progress-stepper",
"src/ebay-radio/__tests__/*": "@ebay/ui-core-react/ebay-radio",
"src/ebay-select/__tests__/*": "@ebay/ui-core-react/ebay-select",
"src/ebay-section-title/__tests__/*": "@ebay/ui-core-react/ebay-section-title",
"src/ebay-signal/__tests__/*": "@ebay/ui-core-react/ebay-signal",
"src/ebay-skeleton/__tests__/*": "@ebay/ui-core-react/ebay-skeleton",
"src/ebay-snackbar-dialog/__tests__/*": "@ebay/ui-core-react/ebay-snackbar-dialog",
"src/ebay-switch/__tests__/*": "@ebay/ui-core-react/ebay-switch",
"src/ebay-tabs/__tests__/*": "@ebay/ui-core-react/ebay-tabs",
"src/ebay-textbox/__tests__/*": "@ebay/ui-core-react/ebay-textbox",
"src/ebay-tooltip/__tests__/*": "@ebay/ui-core-react/ebay-tooltip",
"src/ebay-tourtip/__tests__/*": "@ebay/ui-core-react/ebay-tourtip",
"src/ebay-video/__tests__/*": "@ebay/ui-core-react/ebay-video"
},
"paths": {}
}
}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"storybook-node16": "storybook dev -p 9001 -c .storybook",
"build-storybook": "storybook build",
"storybook:publish": "NODE_OPTIONS=--openssl-legacy-provider yarn build-storybook --output-dir storybook-static/$(git branch --show-current) && gh-pages --add --message=\"Deploying to gh-pages from @ eBay/ebayui-core-react@$(git rev-parse --short HEAD) 🚀\" -d storybook-static",
"figma:publish": "npx figma connect publish --token $FIGMA_TOKEN",
"figma:unpublish": "npx figma connect unpublish --token $FIGMA_TOKEN",
"test": "yarn jest",
"build": "yarn type:check && vite build",
"type:check": "tsc --noEmit",
Expand Down Expand Up @@ -81,6 +83,7 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.11",
"@ebay/skin": "^19",
"@figma/code-connect": "^1.3.2",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@rollup/plugin-typescript": "^11.1.6",
"@storybook/addon-a11y": "^7.6.12",
Expand Down
1 change: 1 addition & 0 deletions src/common/component-utils/forwardRef.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const getDisplayName = <Props, >(Component: FC<Props>) => Component.displayName
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const withForwardRef = <Props, >(Component: FC<Props>) => {
const ForwardRef = forwardRef<FC<Props>, Props>((props, ref) =>
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have this, what is the issue of this type?

<Component {...props} forwardedRef={ref} />)

ForwardRef.displayName = getDisplayName<Props>(Component)
Expand Down
30 changes: 30 additions & 0 deletions src/ebay-accordion/__tests__/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import figma from '@figma/code-connect'

import React from 'react'
import { EbayAccordion, EbayDetails } from '..'

figma.connect(
EbayAccordion,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Evo-Design-System?node-id=256381-3831',
{
example: () => (
<EbayAccordion>
<EbayDetails text="Details summary">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</EbayDetails>

<EbayDetails text="Second summary">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</EbayDetails>
</EbayAccordion>
)
}
)
25 changes: 14 additions & 11 deletions src/ebay-alert-dialog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# EbayAlertDialog

## Demo

[Storybook](https://opensource.ebay.com/ebayui-core-react/main/?path=/story/dialogs-ebay-alert-dialog--default)

## Usage
Expand All @@ -14,23 +15,25 @@

## Attributes

Name | Type | Stateful | Required | Description
--- | --- | --- | --- | ---
`open` | Boolean | Yes | No | Whether dialog is open.
`focus` | String | No | No | An id for an element which will receive focus when the drawer opens (defaults to close button).
`a11yCloseText` | String | No | Yes | A11y text for close button and mask.
`confirmText` | String | No | Yes | Text for confirm button |
`animated` | Boolean | Yes | No | Renders the dialog with an animation. Note that the dialog will always be present in the DOM
| Name | Type | Stateful | Required | Description |
| --------------- | ------- | -------- | -------- | ----------------------------------------------------------------------------------------------- |
| `open` | Boolean | Yes | No | Whether dialog is open. |
| `focus` | String | No | No | An id for an element which will receive focus when the drawer opens (defaults to close button). |
| `a11yCloseText` | String | No | Yes | A11y text for close button and mask. |
| `confirmText` | String | No | Yes | Text for confirm button |
| `animated` | Boolean | Yes | No | Renders the dialog with an animation. Note that the dialog will always be present in the DOM |

## Events

Event | Data | Description
--- |------| ---
`onOpen` | () | triggered when dialog is opened
`onConfirm` | () | triggered when confirm button is clicked
| Event | Data | Description |
| ----------- | ---- | ---------------------------------------- |
| `onOpen` | () | triggered when dialog is opened |
| `onConfirm` | () | triggered when confirm button is clicked |

## EbayDialogHeader

Will render a header content for the dialog. Will always render the header element even if this is not present

## EbayDialogFooter

Will render the footer content for the dialog. If not present then will not have any footer.
23 changes: 23 additions & 0 deletions src/ebay-alert-dialog/__tests__/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import figma from '@figma/code-connect'

import React from 'react'
import { EbayAlertDialog } from '..'
/* @ts-ignore: this is only to help code connect */
import { EbayDialogHeader } from '@ebay/ui-core-react/ebay-dialog-base'

figma.connect(
EbayAlertDialog,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=16420-100',
{
props: {
Title: figma.string('Title'),
Body: figma.string('Body')
},
example: ({ Body, Title }) => (
<EbayAlertDialog open a11yCloseText="Close" confirmText="Confirm">
<EbayDialogHeader>{Title}</EbayDialogHeader>
<p>{Body}</p>
</EbayAlertDialog>
)
}
)
15 changes: 15 additions & 0 deletions src/ebay-badge/__tests__/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import figma from '@figma/code-connect'

import React from 'react'
import { EbayBadge } from '..'

figma.connect(
EbayBadge,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Evo-Design-System?node-id=38612-44629',
{
props: {
number: figma.string('Number')
},
example: ({ number }) => <EbayBadge number={number} />
}
)
18 changes: 18 additions & 0 deletions src/ebay-breadcrumbs/__tests__/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import figma from '@figma/code-connect'

import React from 'react'
import { EbayBreadcrumbs, EbayBreadcrumbItem } from '..'

figma.connect(
EbayBreadcrumbs,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=67603-81724',
{
example: () => (
<EbayBreadcrumbs a11yHeadingText="Page navigation">
<EbayBreadcrumbItem href="https://ebay.com">eBay</EbayBreadcrumbItem>
<EbayBreadcrumbItem href="https://ebay.com/cars">Auto Parts and Vehicles</EbayBreadcrumbItem>
<EbayBreadcrumbItem>Motors Parts and Accessories</EbayBreadcrumbItem>
</EbayBreadcrumbs>
)
}
)
92 changes: 92 additions & 0 deletions src/ebay-button/__tests__/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import figma from '@figma/code-connect'

import React from 'react'
import { EbayButton } from '..'

// button
figma.connect(
EbayButton,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Evo-Design-System?node-id=65849-91206',
{
props: {
state: figma.enum('State', {
disabled: true,
enabled: false
}),
title: figma.string('Title'),
size: figma.enum('Size', {
small: 'small',
large: 'large'
})
},
example: ({ state, size, title }) => (
<EbayButton disabled={state} size={size} variant="standard">
{title}
</EbayButton>
)
}
)

// button destructive
figma.connect(
EbayButton,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Evo-Design-System?node-id=260004-7740',
{
props: {
state: figma.enum('State', {
disabled: true,
enabled: false
}),
title: figma.string('Title'),
size: figma.enum('Size', {
small: 'small',
large: 'large'
})
},
example: ({ state, size, title }) => (
<EbayButton disabled={state} size={size} variant="destructive">
{title}
</EbayButton>
)
}
)

// button branded
figma.connect(
EbayButton,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=129776-224141',
{
props: {
title: figma.string('Title'),
size: figma.enum('Size', {
small: 'small',
large: 'large'
})
},
example: ({ size, title }) => (
<EbayButton size={size}>
{title}
</EbayButton>
)
}
)

// button link (borderless)
figma.connect(
EbayButton,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=109500-131885',
{
props: {
title: figma.string('Title'),
size: figma.enum('Size', {
small: 'small',
large: 'large'
})
},
example: ({ size, title }) => (
<EbayButton size={size} borderless>
{title}
</EbayButton>
)
}
)
Loading
Loading
0