Skip to content

Commit 61d35bc

Browse files
cwoolumChris Woolum
authored andcommitted
Fix the naming of Figma to code (#5129)
Co-authored-by: Chris Woolum <[email protected]>
1 parent 25850bc commit 61d35bc

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

src/directory/directory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,7 @@ const directory = {
23332333
]
23342334
},
23352335
uibuilder: {
2336-
title: 'Figma-to-Code (React)',
2336+
title: 'Figma to Code (React)',
23372337
items: [
23382338
{
23392339
title: 'Overview',
@@ -2368,7 +2368,7 @@ const directory = {
23682368
route: '/console/uibuilder/override'
23692369
},
23702370
{
2371-
title: 'Figma-to-Code best practices',
2371+
title: 'Best practices',
23722372
route: '/console/uibuilder/bestpractices'
23732373
}
23742374
]

src/pages/console/uibuilder/bestpractices.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export const meta = {
2-
title: `Figma-to-Code best practices`,
3-
description: `Constraints of Amplify Studio's Figma-to-React capabilities`,
2+
title: `Figma to Code best practices`,
3+
description: `Constraints of Amplify Studio's Figma to React capabilities`,
44
};
55

6-
We're constantly improving Amplify Studio to make Figma-to-React code conversion better but there are some constraints that need to be taken into account.
6+
We're constantly improving Amplify Studio to make Figma to React code conversion better but there are some constraints that need to be taken into account.
77

88
## Make sure to mark frames as components in Figma
99
Amplify Studio only converts Figma components. If you only have a Figma "frame", Studio will ignore it because frames tend to be used to layout a set of components.
@@ -14,21 +14,21 @@ Learn more about how Figma components work and how to create them with the video
1414

1515
## Fonts aren't automatically integrated
1616

17-
By default, Amplify Studio doesn't automatically export the font from the Figma file and download it as part of your `src/ui-components/` folder. To workaround this, you can include the font like you'd usually do yourself in your React app.
17+
By default, Amplify Studio doesn't automatically export the font from the Figma file and download it as part of your `src/ui-components/` folder. To workaround this, you can include the font like you'd usually do yourself in your React app.
1818

1919
Review the [Adding Fonts](https://create-react-app.dev/docs/adding-images-fonts-and-files/) documentation from the Create React App on how to configure this.
2020

2121
## Try to use Figma Auto layout whenever possible
2222

23-
Figma "Auto layout" can make a component significantly more responsive than used fixed position of elements. Think of Figma's Auto layout as "Flexboxes" (`display: flex`) in CSS.
23+
Figma "Auto layout" can make a component significantly more responsive than used fixed position of elements. Think of Figma's Auto layout as "Flexboxes" (`display: flex`) in CSS.
2424

2525
Learn more about how Figma's Auto layout works with the video below from the Figma team:
2626

2727
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/PNJxeD29ZTg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2828

2929
## Represent UI element states in code (hover, active)
3030

31-
Amplify Studio currently doesn't support Figma-to-React code conversion of UI state. For example, if you want to add a hover effect to a button, you need to [override the component behavior in code](/console/uibuilder/override/#set-hover-states-on-icons) instead of creating a hover variant in Figma.
31+
Amplify Studio currently doesn't support Figma to React code conversion of UI state. For example, if you want to add a hover effect to a button, you need to [override the component behavior in code](/console/uibuilder/override/#set-hover-states-on-icons) instead of creating a hover variant in Figma.
3232

3333
## Figma variants must have the same child elements
3434

src/pages/console/uibuilder/responsive.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const meta = {
22
title: `Responsive Components`,
3-
description: `Learn how to configure Figma-to-Code components in order for them to scale according to breakpoints`,
3+
description: `Learn how to configure Figma to Code components in order for them to scale according to breakpoints`,
44
};
55

66
You can use Amplify Studio to dynamically toggle between different component variants based on your app's breakpoint. For example, you can have the navigation bar shrink to a smaller size as the window gets smaller.
@@ -9,7 +9,7 @@ You can use Amplify Studio to dynamically toggle between different component var
99

1010
## 1. Set your preferred breakpoints in Figma
1111

12-
To apply breakpoints to components generated by Amplify Studio, you must have a Figma account with the [AWS Amplify Theme Editor](https://www.figma.com/community/plugin/1040722185526429545/AWS-Amplify-Theme-Editor) plugin installed.
12+
To apply breakpoints to components generated by Amplify Studio, you must have a Figma account with the [AWS Amplify Theme Editor](https://www.figma.com/community/plugin/1040722185526429545/AWS-Amplify-Theme-Editor) plugin installed.
1313

1414
By default, all Amplify UI provides the following [breakpoints as part of the Amplify UI theme](https://ui.docs.amplify.aws/react/theming/responsive#breakpoints):
1515

@@ -41,11 +41,11 @@ To make a component responsive, create different variants for the component base
4141

4242
<Callout warning>
4343

44-
**IMPORTANT:** The variants are required to have the same <strong>component structure</strong>. Elements within the component structure must also use the same <strong>layout method</strong> (i.e. "Auto Layout" or manual).
44+
**IMPORTANT:** The variants are required to have the same <strong>component structure</strong>. Elements within the component structure must also use the same <strong>layout method</strong> (i.e. "Auto Layout" or manual).
4545

4646
If the variants don't have the same structure, then Amplify Studio will not be able to import the component.
4747

48-
To customize child elements in variants, you can use the eye icon to hide and show elements in different variants.
48+
To customize child elements in variants, you can use the eye icon to hide and show elements in different variants.
4949

5050
![Image showing that the component structure needs to be the same](/images/studio/responsive/component-structure2.png)
5151

@@ -72,7 +72,7 @@ With your design complete in Figma, import and render your component using Ampli
7272

7373
Figma allows users to create variants based on multiple properties. For example, a component may need `breakpoint` variants (small, medium, and large) and `displayMode` variants (light mode, dark mode).
7474

75-
If your component has any variant properties in addition to `breakpoint`, additional steps are required for responsiveness. All additional properties <i>must</i> be given inline values, or the component will not be responsive.
75+
If your component has any variant properties in addition to `breakpoint`, additional steps are required for responsiveness. All additional properties <i>must</i> be given inline values, or the component will not be responsive.
7676

7777
In the below examples, the `ResponsiveToolbar` component has both `breakpoint` and `displayMode` variants. In the first example, the component will not automatically be responsive.
7878

@@ -100,7 +100,7 @@ function App() {
100100
export default App;
101101
```
102102

103-
Alternatively, multidimensional variants can be separated into separate components, each with only the `breakpoint` variant property. For example, the above component could be split into `ResponsiveToolbarLight` and `ResponsiveToolbarDark`, and rendered conditionally.
103+
Alternatively, multidimensional variants can be separated into separate components, each with only the `breakpoint` variant property. For example, the above component could be split into `ResponsiveToolbarLight` and `ResponsiveToolbarDark`, and rendered conditionally.
104104

105105
```jsx
106106
function App() {
@@ -113,4 +113,4 @@ function App() {
113113
);
114114
}
115115
export default App;
116-
```
116+
```

src/pages/console/uibuilder/slots.mdx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export const meta = {
22
title: `Component slots`,
3-
description: `Add component slots to Amplify-generated Figma-to-code components. Use this to support nested components or collections in React code.`,
3+
description: `Add component slots to Amplify-generated Figma to code components. Use this to support nested components or collections in React code.`,
44
};
55

66
Component slots allow you to nest other components as React code within your Studio-generated UI components. You can use component slots to create dynamically generated child components, like Comments on a Post, or to replace a child element altogether.
77

88
## Adding a component slot
9-
First, you'll need a component.
9+
First, you'll need a component.
1010
1. Log into Amplify and [navigate to Studio](/console/adminui/start/).
1111

1212
2. On the left-hand navigation bar, click UI Library
@@ -18,44 +18,44 @@ First, you'll need a component.
1818

1919
![Animated image of opening a component and clicking the gear icon to configure](/images/console/slots-console1.gif)
2020

21-
Next, you'll add a component slot to this component.
22-
1. On the left-hand side, you'll see the elements of your component. Select a Figma **Frame** (![Figma frame icon](/images/console/figma-frame-icon.png)) within your component.
21+
Next, you'll add a component slot to this component.
22+
1. On the left-hand side, you'll see the elements of your component. Select a Figma **Frame** (![Figma frame icon](/images/console/figma-frame-icon.png)) within your component.
2323

2424
In this example, the "Area" frame is selected.
2525

2626
2. On the right-hand panel, click the "Convert to a slot" button. This will add a new prop to your UI component. Any JSX element you pass into that prop will be rendered in the generated component slot.
2727

28-
3. Optionally, change your property name.
28+
3. Optionally, change your property name.
2929

3030
In this example, the property has been renamed "comments"
3131

3232
![Animated image of selecting a frame and add a component slot](/images/console/slots-console2.gif)
3333

3434
<Callout warning>
3535

36-
Want to undo your component slot creation?
36+
Want to undo your component slot creation?
3737

3838
Locate your component slot in the **Component properties** (top-right corner), click the triple-dot menu, and click **Erase property** to remove the component slot.
3939

4040
</Callout>
4141

4242
## Render the component with component slots in React code
4343
### Importing your component
44-
Once you've added a component slot to your component, click the **Get component code** button at the bottom of the screen to see instructions on the next steps.
44+
Once you've added a component slot to your component, click the **Get component code** button at the bottom of the screen to see instructions on the next steps.
4545
1. Copy the `amplify pull` command, and run it in your Terminal
4646
2. Copy the import code and paste it in your React app code
4747
3. Lastly, render the component
4848

4949
```jsx
5050
/*Import your component*/
51-
import {
52-
Ampligram
51+
import {
52+
Ampligram
5353
} from './ui-components'
5454

5555
function App() {
5656
return (
5757
/*Add your component below*/
58-
<Ampligram style={styles.post}/>
58+
<Ampligram style={styles.post}/>
5959
);
6060
}
6161
const styles = {
@@ -69,19 +69,19 @@ Here's how the code above would render in your app. *Some minor styling has been
6969
![Screenshot of an imported component with a component slot](/images/console/slots1.png)
7070

7171
### Using your component slot to replace individual child components
72-
To use the component slot, pass a child component as a property of the parent component, using the prop name you picked earlier. Then, the content you pass will be rendered as a child of the component.
72+
To use the component slot, pass a child component as a property of the parent component, using the prop name you picked earlier. Then, the content you pass will be rendered as a child of the component.
7373

7474

7575
````jsx
76-
import {
77-
Ampligram
76+
import {
77+
Ampligram
7878
} from '.ui-components'
7979

8080
function App() {
8181
return (
8282
<Ampligram style={styles.post} comments={
8383
/* Pass your content into the component slot */
84-
<div style={styles.comment}>
84+
<div style={styles.comment}>
8585
<h1>Hi mom!</h1>
8686
<p>Thanks for checking out my app</p>
8787
</div>
@@ -100,32 +100,32 @@ Here's how the code above would render in your app. *Some styling has been added
100100
![Screenshot of a component with static text in the component slot](/images/console/slots2.png)
101101

102102
### Adding component slots to collections
103-
Any component can be [converted to a collection](/console/uibuilder/collections/) and bound to data, and that includes components with component slots. With a collection, you can [extend your component via code](/console/uibuilder/override/) using the `overrideItems` prop to generate unique content within each component slot.
103+
Any component can be [converted to a collection](/console/uibuilder/collections/) and bound to data, and that includes components with component slots. With a collection, you can [extend your component via code](/console/uibuilder/override/) using the `overrideItems` prop to generate unique content within each component slot.
104104

105-
Here, the Ampligram collection is mapped to a data model called Post. The Post model has a field called Comment, which contains an array of all the Comments associated with this Post. Each of these items in the Comment array is then mapped to the "comments" component slot you created.
105+
Here, the Ampligram collection is mapped to a data model called Post. The Post model has a field called Comment, which contains an array of all the Comments associated with this Post. Each of these items in the Comment array is then mapped to the "comments" component slot you created.
106106

107-
Dynamically rendering child components is where component slots get very useful - you can even [pass another collection](/console/uibuilder/override/#nesting-collections) into this component slot.
107+
Dynamically rendering child components is where component slots get very useful - you can even [pass another collection](/console/uibuilder/override/#nesting-collections) into this component slot.
108108

109109
<Callout note>
110110
<strong>Limitation: Nested data fetching for many-to-many relationships</strong>
111111
<p>
112-
Automatic nested data fetching for many-to-many relationships is currently not supported. Currently, component slots only automatically fetches data for [has One](/cli/graphql/data-modeling/#has-one-relationship) and [has Many relationships](/cli/graphql/data-modeling/#has-many-relationship), like one Post to many Comments.
112+
Automatic nested data fetching for many-to-many relationships is currently not supported. Currently, component slots only automatically fetches data for [has One](/cli/graphql/data-modeling/#has-one-relationship) and [has Many relationships](/cli/graphql/data-modeling/#has-many-relationship), like one Post to many Comments.
113113
</p>
114114
</Callout>
115115

116-
The code below will render an Ampligram for each Post in the AmpligramCollection. Then, the Comments for each Post will render in the "comments" component slot.
116+
The code below will render an Ampligram for each Post in the AmpligramCollection. Then, the Comments for each Post will render in the "comments" component slot.
117117

118118
In this example, the first Post has 2 comments, but the second post has none.
119119

120120
```jsx
121-
import {
122-
AmpligramCollection
121+
import {
122+
AmpligramCollection
123123
} from './ui-components'
124124

125125
function App() {
126126
return (
127127
<AmpligramCollection style={styles.post} overrideItems={({ item }) => ({
128-
comments:
128+
comments:
129129
<div style={styles.post}>
130130
{item.Comments.map(comment => <div>{comment.content}</div>)}
131131
</div>

0 commit comments

Comments
 (0)