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

Figma Code Connect #345

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ junit.xml
.xo-resources.json
coverage
/.vscode
/storybook-static
/storybook-static
33 changes: 33 additions & 0 deletions figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"codeConnect": {
"include": ["src/**/*.figma.tsx", "src/**/*.tsx"],
"exclude": ["test/**", "docs/**", "build/**"],

"react": {
"importPaths": {
"src/ebay-alert-dialog/*": "@ebay/ui-core-react/ebay-alert-dialog",
"src/ebay-badge/*": "@ebay/ui-core-react/ebay-badge",
"src/ebay-breadcrumbs/*": "@ebay/ui-core-react/ebay-breadcrumbs",
"src/ebay-button/*": "@ebay/ui-core-react/ebay-button",
"src/ebay-calendar/*": "@ebay/ui-core-react/ebay-calendar",
"src/ebay-checkbox/*": "@ebay/ui-core-react/ebay-checkbox",
"src/ebay-icon-button/*": "@ebay/ui-core-react/ebay-icon-button",
"src/ebay-page-notice/*": "@ebay/ui-core-react/ebay-page-notice",
"src/ebay-pagination/*": "@ebay/ui-core-react/ebay-pagination",
"src/ebay-progress-stepper/*": "@ebay/ui-core-react/ebay-progress-stepper",
"src/ebay-radio/*": "@ebay/ui-core-react/ebay-radio",
"src/ebay-select/*": "@ebay/ui-core-react/ebay-select",
"src/ebay-section-title/*": "@ebay/ui-core-react/ebay-section-title",
"src/ebay-signal/*": "@ebay/ui-core-react/ebay-signal",
"src/ebay-snackbar-dialog/*": "@ebay/ui-core-react/ebay-snackbar-dialog",
"src/ebay-switch/*": "@ebay/ui-core-react/ebay-switch",
"src/ebay-tabs/*": "@ebay/ui-core-react/ebay-tabs",
"src/ebay-textbox/*": "@ebay/ui-core-react/ebay-textbox",
"src/ebay-tooltip/*": "@ebay/ui-core-react/ebay-tooltip",
"src/ebay-tourtip/*": "@ebay/ui-core-react/ebay-tourtip",
"src/ebay-video/*": "@ebay/ui-core-react/ebay-video"
},
"paths": {}
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.0.0",
"@ebay/skin": "^17.0.0",
"@figma/code-connect": "^0.1.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to also add a new script that we will need to use to make the connection

"scripts": {
   ...,
   "figma:connect": "figma connect publish \"https://...\" --token $FIGMA_TOKEN"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HenriqueLimas this has been added, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@storybook/addon-a11y": "^7.6.12",
"@storybook/addon-essentials": "^7.4.6",
Expand Down
2 changes: 1 addition & 1 deletion src/ebay-alert-dialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Usage

```react
<EbayAlertDialog open a11yClosetext="Close">
<EbayAlertDialog open a11yCloseText="Close">
<EbayDialogHeader>Heading</EbayDialogHeader>
<p>Body content</p>
</EbayAlertDialog>
Expand Down
23 changes: 23 additions & 0 deletions src/ebay-alert-dialog/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&m=dev',
{
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/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-Design-System?node-id=38612-44629&m=dev',
{
props: {
label: figma.string('label')
},
example: ({ label }) => <EbayBadge number={label} />
}
)
18 changes: 18 additions & 0 deletions src/ebay-breadcrumbs/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&m=dev',
{
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>
)
}
)
96 changes: 96 additions & 0 deletions src/ebay-button/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import figma from '@figma/code-connect'

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

// button
figma.connect(
EbayButton,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=65849-91206&m=dev',
{
props: {
state: figma.enum('state', {
disabled: true,
enabled: false
}),
title: figma.string('Title'),
size: figma.enum('size', {
medium: 'regular',
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-Design-System?node-id=129298-738861&m=dev',
{
props: {
state: figma.enum('state', {
disabled: true,
enabled: false
}),
title: figma.string('Title'),
size: figma.enum('size', {
medium: 'regular',
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&m=dev',
{
props: {
title: figma.string('Title'),
size: figma.enum('size', {
medium: 'regular',
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&m=dev',
{
props: {
title: figma.string('Title'),
size: figma.enum('size', {
medium: 'regular',
small: 'small',
large: 'large'
})
},
example: ({ size, title }) => (
<EbayButton size={size} borderless>
{title}
</EbayButton>
)
}
)
40 changes: 20 additions & 20 deletions src/ebay-calendar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ import "@ebay/skin/calendar";

## Attributes

| Name | Type | Stateful | Description | Data |
| Name | Type | Stateful | Description | Data | |
| ---------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | --- |
| `navigable` | Boolean | No | If true, a header is included that allows for navigation between months |
| `interactive` | Boolean | No | Date cells are contained in buttons for interactive calendars, and spans otherwise |
| `numMonths` | Number | No | Number of months to be displayed at once |
| `range` | Boolean | No | True if selecting a range, false if a single value |
| `selected` | Date, Date[] | No | Date or list of dates that are selected, represented as an ISO string or an array of ISO strings |
| `locale` | String | No | Locale of the date picker, default to `navigator.language` |
| `disableBefore` | Date | No | First date that may be selected |
| `disableAfter` | Date | No | Last date that may be selected |
| `disableWeekdays` | Number[] | No | List of weekdays that are disabled. Must be an array of numbers, where Sunday is `0` and Saturday is `6` |
| `disableList` | String[], Date[] | No | List of specific days that are disabled. Should be a list of ISO strings, but also accepts timestamps or `Date` objects |
| `linkBuilder` | Function | No | Function used to build the href for each date. The function is passed the date as a `Date` object, and should return a url string. For dates that don't have a link, the function should return a falsy value |
| `getA11yShowMonthText` | Function | No | Function used to get the text for showing previous and next months, defaults to `Show ${monthName}` |
| `a11ySelectedText` | String | No | Text to be read by screen readers when a date is selected, defaults to `Selected` |
| `a11yRangeStartText` | String | No | Text to be read by screen readers when a date is the start of a range, defaults to `Start of range` |
| `a11yInRangeText` | String | No | Text to be read by screen readers when a date is in a range, defaults to `in range` |
| `a11yRangeEndText` | String | No | Text to be read by screen readers when a date is the end of a range, defaults to `End of range` |
| `a11yTodayText` | String | No | Text to be read by screen readers when a date is the current date, defaults to `Today` |
| `a11yDisabledText` | String | No | Text to be read by screen readers when a date is disabled, defaults to `inactive` |
| `a11ySeparator` | String | No | Text to be read by screen readers to separate properties, defaults to `-` |
| `navigable` | Boolean | No | If true, a header is included that allows for navigation between months | | |
| `interactive` | Boolean | No | Date cells are contained in buttons for interactive calendars, and spans otherwise | | |
| `numMonths` | Number | No | Number of months to be displayed at once | | |
| `range` | Boolean | No | True if selecting a range, false if a single value | | |
| `selected` | Date, Date[] | No | Date or list of dates that are selected, represented as an ISO string or an array of ISO strings | | |
| `locale` | String | No | Locale of the date picker, default to `navigator.language` | | |
| `disableBefore` | Date | No | First date that may be selected | | |
| `disableAfter` | Date | No | Last date that may be selected | | |
| `disableWeekdays` | Number[] | No | List of weekdays that are disabled. Must be an array of numbers, where Sunday is `0` and Saturday is `6` | | |
| `disableList` | String[], Date[] | No | List of specific days that are disabled. Should be a list of ISO strings, but also accepts timestamps or `Date` objects | | |
| `linkBuilder` | Function | No | Function used to build the href for each date. The function is passed the date as a `Date` object, and should return a url string. For dates that don't have a link, the function should return a falsy value | | |
| `getA11yShowMonthText` | Function | No | Function used to get the text for showing previous and next months, defaults to `Show ${monthName}` | | |
| `a11ySelectedText` | String | No | Text to be read by screen readers when a date is selected, defaults to `Selected` | | |
| `a11yRangeStartText` | String | No | Text to be read by screen readers when a date is the start of a range, defaults to `Start of range` | | |
| `a11yInRangeText` | String | No | Text to be read by screen readers when a date is in a range, defaults to `in range` | | |
| `a11yRangeEndText` | String | No | Text to be read by screen readers when a date is the end of a range, defaults to `End of range` | | |
| `a11yTodayText` | String | No | Text to be read by screen readers when a date is the current date, defaults to `Today` | | |
| `a11yDisabledText` | String | No | Text to be read by screen readers when a date is disabled, defaults to `inactive` | | |
| `a11ySeparator` | String | No | Text to be read by screen readers to separate properties, defaults to `-` | | |
| `onFocus` | Function | - | Triggered when a day is focused on, typically via keyboard events | `(event: FocusEvent, { iso })` | |
| `onSelect` | Function | - | Triggered when a day is selected | `(event: Event, { iso })` | |
| `onMonthChange` | Function | - | Triggered during month navigation | `(event: Event, { iso })` | |
26 changes: 26 additions & 0 deletions src/ebay-calendar/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import figma from '@figma/code-connect'

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

// single month
figma.connect(
EbayCalendar,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=68524-79110&m=dev',
{
example: () => (
<EbayCalendar />
)
}
)

// multi-month
figma.connect(
EbayCalendar,
'https://www.figma.com/design/zEBdEhbonrBOGzZ0fXzWvM/eBay-Design-System?node-id=68524-79119&m=dev',
{
example: () => (
<EbayCalendar numMonths={2} />
)
}
)
Loading
Loading