Skip to content

Commit d861975

Browse files
author
Matt
committed
docs: import-figma-ui-update
1 parent 69561a0 commit d861975

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

simple-calc/art/Light/app-looks.png

67.8 KB
Loading

simple-calc/modules/Import-UI-from-Figma/Conclusion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ uid: Workshop.SimpleCalc.Figma.Conclusion
44

55
## Run the app
66

7-
Run the app (<kbd>F5</kbd> on Visual Studio) and observe the UI, it should look similar to the following:
7+
Run the app (<kbd>F5</kbd> on Visual Studio) and observe the UI. It should resemble the example below:
88

99
<picture>
1010
<source media="(prefers-color-scheme: dark)" srcset="../../../art/Dark/app-looks.png">
@@ -14,4 +14,4 @@ Run the app (<kbd>F5</kbd> on Visual Studio) and observe the UI, it should look
1414

1515
## Next Step
1616

17-
The next module offers an alternative way to import the UI code without Figma. Since you've already imported the UI, you may skip to Module 4, where you will add the app architecture.
17+
The next module offers an alternative way to import the UI code without using Figma. Since you've already imported the UI, you can skip to Module 4, where you will add the app architecture.

simple-calc/modules/Import-UI-from-Figma/Intro.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,30 @@ Figma is a collaborative app UI design tool that allows users to create, share,
1010
Uno Platform offers a Figma plugin that enables exporting the UI designed in Figma as both XAML and C# Markup.
1111
In this module, you'll learn how to export the UI from a pre-existing Figma design for the SimpleCalculator app, and how to import it into the app you've started to create in the previous modules.
1212

13-
## Open the Figma file and set up an account
13+
## Opening the Figma file and setting up an account
1414

15-
1. Open the SimpleCalculator Figma file via [this link](https://aka.platform.uno/uno-figma-simplecalc-workshop).
15+
1. Use [this link](https://aka.platform.uno/uno-figma-simplecalc-workshop) to access the Figma file for the Simple Calculator project. When you click on the link, it will take you to the Simple Calculator community file, where you can proceed to open it in Figma.
1616

17-
1. If you are not signed in with Figma, you will be asked to do so. Create an account if you don't have one. Follow the instructions to sign up with your Google account or use a username and password.
17+
Note: If you are not currently signed in to Figma, you will be prompted to do so. If you don't have an account, you can create one by following the instructions to sign up with your Google account or using a username and password.
1818

1919
![Figma sign-in page](../../art/figma-sign-in.jpg)
2020

21-
## Install the Uno Platform plugin for Figma
21+
## Installing the Uno Platform plugin for Figma
2222

23-
1. The SimpleCalculator design will open in Figma, displaying the Cover page:
23+
2. The SimpleCalculator file will open in Figma, displaying the Cover page. To export the generated code from the Simple Calculator UI, you'll need to install the Uno Platform plugin.
2424

2525
![Figma menu plugin](../../art/figma-cover.png)
2626

27-
1. To export the UI from Figma, you'll need to install the Uno Platform plugin. To enable that you will need to create your own copy of the SimpleCalculator design.
28-
In the top menu in the center of the screen click the little down arrow and select *Duplicate to your drafts* from the menu.
27+
3. From within the Simple Calculator Figma file, navigate to the "Resources" tab, and under plugins, search for "Uno Platform (Figma to C# and XAML).
2928

30-
![Figma menu plugin](../../art/figma-duplicate-drafts.png)
31-
32-
1. The duplicated file will open in a new tab and additional menu items and controls will appear on the Figma ribbon.
33-
34-
![Figma menu plugin](../../art/figma-menu-plugin.png)
29+
![Figma Plugin Launch](../../art/figma-plugin-launch.png)
3530

36-
1. In the search box enter "Uno Platform (Figma-To-XAML)". Launch the plugin by clicking the Uno Platform plugin.
31+
4. Install the plugin by clicking "Run" or "Try it out” from the community page.
3732

38-
![Figma Plugin Launch](../../art/figma-plugin-launch.png)
33+
![Figma Plugin Launch](../../art/figma-run-plugin.png)
3934

40-
## Export the UI
35+
## Exporting the UI
4136

42-
1. The page designed in the SimpleCalculator design in Figma is listed in the left-side navigation bar. Select **Simple Calculator design**, then select **Simple Calc** (either Dark or Light version) option that appears at the bottom of the sidebar.
37+
1. In the left-side navigation bar, locate the Simple Calculator UI design by selecting the "Calculator" page, and within the layers, choose either the "Dark" or "Light" version.
4338

4439
![Select Figma Design](../../art/figma-select-design.png)

simple-calc/modules/Resources/CSharp/Figma/Import-UI-from-Figma.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ uid: Workshop.SimpleCalc.Figma.CSharp
44

55
[!include[Setting up Figma Plugin](../../../Import-UI-from-Figma/Intro.md)]
66

7-
2. Open the Export tab, select C#, then click Refresh (the circled arrow button on the bottom).
7+
2. Run the plugin by right-clicking on the design and selecting "Plugins" > Uno Platform (Figma to C# or XAML).
8+
9+
7. Once the plugin is running, select the "Export" tab, and choose "C#" as your export language, then click "Refresh" (the circular arrow button at the bottom).
810

911
![Figma menu plugin](../../../../art/figma-plugin-export-csharp.png)
1012

11-
3. Select all contents starting from the line following `this` and ending at the semicolon (;).
13+
8. Select all the code starting from the line following `this` and ending at the semicolon (;).
1214

1315
![Figma Export](../../../../art/figma-export-csharp.png)
1416

17+
9. Copy the selected code to your clipboard (CTRL+C on Windows).
18+
1519
<details>
1620
<summary><i>MainPage.cs</i> code contents (collapsed for brevity)</summary>
1721

@@ -20,9 +24,12 @@ uid: Workshop.SimpleCalc.Figma.CSharp
2024

2125
4. Copy the selected code to the clipboard (<kbd>Ctrl</kbd>+<kbd>C</kbd> on Windows).
2226

23-
5. Open MainPage.cs and replace all the Page contents with the copied code.
27+
5. Open MainPage.cs and replace all the existing code following `this` and ending at the semicolon (;) with the copied code.
28+
29+
6. To set the appropriate font size for all buttons, go to the Figma Plugin in the "Export" tab, select "Fonts Override File" from the dropdown menu, and copy the content in the ResourceDictionary.
30+
31+
7. Access the "MaterialFontsOverride.cs" file in the "Style" folder and replace it with your "MaterialFontsOverride.cs."
2432

25-
6. To set the appropriate font size for all buttons, access the MaterialFontsOverride.cs file in the Style folder. Go to the Figma Plugin, in the Export tab, and select Fonts Override File from the dropdown menu. Copy the content in the ResourceDictionary and replace it in your MaterialFontsOverride.cs.
2633

2734
![Figma Export](../../../../art/figma-export-fonts-csharp.png)
2835

@@ -32,7 +39,7 @@ uid: Workshop.SimpleCalc.Figma.CSharp
3239
[!code-csharp[MaterialFontsOverride.cs](MaterialFontsOverride.cs)]
3340
</details>
3441

35-
7. Now we need to prepare our UI with the Binding expressions that we will need in the App Architecture module. First let's add the `DataContext` to the page. To do so add `.DataContext(new TempDataContext(), (page, vm) => page` before the `.Content` definition. Ensure to properly terminate the DataContext with a closing `)` preceding the semicolon at the end of the page's code.
42+
8. Now we need to prepare our UI with the Binding expressions that we will need in the App Architecture module. First let's add the `DataContext` to the page. To do so add `.DataContext(new TempDataContext(), (page, vm) => page` before the `.Content` definition. Ensure to properly terminate the DataContext with a closing `)` preceding the semicolon at the end of the page's code.
3643

3744
```csharp
3845
this

0 commit comments

Comments
 (0)