Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ yarn-error.log*
# Autogenerated CSS
/docs/css/salt-core.css
/docs/css/salt-lab.css
/docs/css/salt-countries.css
/docs/css/salt-countries.css

# Figma code connect
.env
mockFigmaResponse.json
14 changes: 14 additions & 0 deletions figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"codeConnect": {
"include": [
"packages/core/src/**/*.{tsx,jsx}",
"packages/core/figma-src/**/*.{tsx,jsx}",
"packages/icons/src/**/*.{tsx,jsx}"
],
"exclude": ["**/__tests__/*.{tsx,jsx}"],
"importPaths": {
"packages/core/src/*": "@salt-ds/core",
"packages/icons/*": "@salt-ds/icons"
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@changesets/cli": "^2.27.12",
"@cypress/code-coverage": "^3.13.6",
"@faker-js/faker": "^8.0.0",
"@figma/code-connect": "^1.3.1",
"@fontsource/open-sans": "^4.5.13",
"@fontsource/pt-mono": "^5.0.12",
"@mswjs/data": "^0.16.1",
Expand Down
56 changes: 56 additions & 0 deletions packages/core/figma-src/Avatar.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import figma from "@figma/code-connect";
import { Avatar } from "../src/avatar/Avatar";

// Icon variant - https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?m=auto&node-id=24377-78056
figma.connect(
Avatar,
"https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?node-id=24377-78056",
{
props: {
size: figma.enum("Size", {
"1x": 1,
"2x": 2,
"3x": 3,
"4x": 4,
}),
},
example: (props) => <Avatar size={props.size} />,
},
);

// Initials
figma.connect(
Avatar,
"https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?node-id=24377%3A78140",
{
props: {
size: figma.enum("Size", {
"1x": 1,
"2x": 2,
"3x": 3,
"4x": 4,
}),
// initialsValue: figma.string("Initials value"), // initialsValue in code is generated automatically
},
example: (props) => <Avatar size={props.size} name="Foo Bar" />,
},
);

// Image - https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?m=auto&node-id=5688-71628
figma.connect(
Avatar,
"https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?node-id=5688-71628",
{
props: {
size: figma.enum("Size", {
"1x": 1,
"2x": 2,
"3x": 3,
"4x": 4,
}),
},
example: (props) => (
<Avatar size={props.size} name="Foo Bar" src="/img/examples/avatar.png" />
),
},
);
32 changes: 32 additions & 0 deletions packages/core/figma-src/Badge.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import figma from "@figma/code-connect";
import { Badge } from "../src/badge/Badge";

/**
* -- This file was auto-generated by Code Connect --
* None of your props could be automatically mapped to Figma properties.
* You should update the `props` object to include a mapping from your
* code props to Figma properties, and update the `example` function to
* return the code example you'd like to see in Figma
*/

figma.connect(
Badge,
"https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?node-id=9106%3A83184",
{
props: {
value: figma.string("Badge value"),
// No matching props could be found for these Figma properties:
},
example: ({ value }) => <Badge value={value} />,
},
);

// Manual created - Dot badge
figma.connect(
Badge,
"https://www.figma.com/design/7Fh5JbUUM84pYwLt9tpJh2/Salt-DS-Components-and-Patterns?node-id=31292-7021",
{
props: {},
example: () => <Badge />,
},
);
Loading
Loading