-
Notifications
You must be signed in to change notification settings - Fork 37
Integrating Figma code connect + mapping first 10 components #2369
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
Changes from 14 commits
c5a047b
c8f647c
3efed85
de1316f
947015e
83b4e5d
7bd7a63
cdfd4b8
db367e4
e2a976c
3e0f565
d7dc382
30bf96e
1e19046
8f69aff
aee01c4
3cdd55d
e6d8ae2
f863118
78e1494
4a60a41
b5280a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,16 @@ name: Build | |
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| figma_enabled: | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| secrets: | ||
| GH_APP_PRIVATE_KEY: | ||
| required: true | ||
| FIGMA_ACCESS_TOKEN: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this been added to the secrets? Who owns it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its in the backpack android Github secretes yes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes but whose figma account generated it? |
||
| required: false | ||
|
|
||
|
|
||
| defaults: | ||
|
|
@@ -105,6 +112,31 @@ jobs: | |
| - name: Unit Tests | ||
| run: ./gradlew test${{ env.flavour }}${{ env.config }}UnitTest -PdisablePreDex | ||
|
|
||
| - name: Check for Code Connect changes | ||
| id: code-connect-filter | ||
| if: ${{ inputs.figma_enabled }} | ||
| uses: dorny/paths-filter@v3 | ||
| with: | ||
| filters: | | ||
| code_connect: | ||
| - 'app/src/main/java/net/skyscanner/backpack/demo/figma/**' | ||
| - 'figma.config.json' | ||
|
|
||
| - name: Install Figma Code Connect | ||
| if: ${{ inputs.figma_enabled && steps.code-connect-filter.outputs.code_connect == 'true' }} | ||
| continue-on-error: true | ||
| run: npm install -g @figma/code-connect@1.3.5 | ||
LokmaneKrizou marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Validate Code Connect files | ||
| if: ${{ inputs.figma_enabled && steps.code-connect-filter.outputs.code_connect == 'true' }} | ||
| continue-on-error: true | ||
| run: | | ||
| echo "🔍 Found Code Connect files, validating..." | ||
| npx figma connect parse | ||
| npx figma connect publish --dry-run | ||
| env: | ||
| FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_ACCESS_TOKEN }} | ||
|
|
||
| Android: | ||
| name: Android tests | ||
| runs-on: ubuntu-24.04-16cores-public | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,241 @@ | ||
| import androidx.compose.runtime.Composable | ||
| import com.figma.code.connect.Figma | ||
| import com.figma.code.connect.FigmaConnect | ||
| import com.figma.code.connect.FigmaProperty | ||
| import com.figma.code.connect.FigmaType | ||
| import com.figma.code.connect.FigmaVariant | ||
| import net.skyscanner.backpack.compose.button.BpkButton | ||
| import net.skyscanner.backpack.compose.button.BpkButtonIconPosition | ||
| import net.skyscanner.backpack.compose.button.BpkButtonSize | ||
| import net.skyscanner.backpack.compose.button.BpkButtonType | ||
| import net.skyscanner.backpack.compose.icon.BpkIcon | ||
| import net.skyscanner.backpack.compose.tokens.ArrowRight | ||
|
|
||
| @FigmaConnect("FIGMA_BUTTON") | ||
| @FigmaVariant(key = "Icon", value = "None") | ||
| class BpkButtonCodeConnect { | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Style") | ||
| val type: BpkButtonType = Figma.mapping( | ||
| "Primary" to BpkButtonType.Primary, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we're missing a single source of truth for this, would that be something Supernova could do? |
||
| "Secondary" to BpkButtonType.Secondary, | ||
| "Featured" to BpkButtonType.Featured, | ||
| "Destructive" to BpkButtonType.Destructive, | ||
| "Primary on Dark" to BpkButtonType.PrimaryOnDark, | ||
| "Primary on Light" to BpkButtonType.PrimaryOnLight, | ||
| "Secondary on Dark" to BpkButtonType.SecondaryOnDark, | ||
| "Link" to BpkButtonType.Link, | ||
| "Link on Dark" to BpkButtonType.LinkOnDark, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val enabled: Boolean = Figma.mapping( | ||
| "Normal" to true, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to true, | ||
| "Focused" to true, | ||
| "Hover" to true, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val loading: Boolean = Figma.mapping( | ||
| "Normal" to false, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to false, | ||
| "Focused" to false, | ||
| "Hover" to false, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Size") | ||
| val size: BpkButtonSize = Figma.mapping( | ||
| "Default" to BpkButtonSize.Default, | ||
| "Large" to BpkButtonSize.Large, | ||
| ) | ||
|
|
||
| @Composable | ||
| fun ComponentExample() { | ||
| BpkButton( | ||
| text = "Label", | ||
| type = type, | ||
| size = size, | ||
| enabled = enabled, | ||
| loading = loading, | ||
| onClick = { }, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @FigmaConnect("FIGMA_BUTTON") | ||
| @FigmaVariant(key = "Icon", value = "Left") | ||
| class BpkButtonLeftIconCodeConnect { | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Style") | ||
| val type: BpkButtonType = Figma.mapping( | ||
| "Primary" to BpkButtonType.Primary, | ||
| "Secondary" to BpkButtonType.Secondary, | ||
| "Featured" to BpkButtonType.Featured, | ||
| "Destructive" to BpkButtonType.Destructive, | ||
| "Primary on Dark" to BpkButtonType.PrimaryOnDark, | ||
| "Primary on Light" to BpkButtonType.PrimaryOnLight, | ||
| "Secondary on Dark" to BpkButtonType.SecondaryOnDark, | ||
| "Link" to BpkButtonType.Link, | ||
| "Link on Dark" to BpkButtonType.LinkOnDark, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val enabled: Boolean = Figma.mapping( | ||
| "Normal" to true, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to true, | ||
| "Focused" to true, | ||
| "Hover" to true, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val loading: Boolean = Figma.mapping( | ||
| "Normal" to false, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to false, | ||
| "Focused" to false, | ||
| "Hover" to false, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Size") | ||
| val size: BpkButtonSize = Figma.mapping( | ||
| "Default" to BpkButtonSize.Default, | ||
| "Large" to BpkButtonSize.Large, | ||
| ) | ||
|
|
||
| @Composable | ||
| fun ComponentExample() { | ||
| BpkButton( | ||
| text = "Label", | ||
| type = type, | ||
| size = size, | ||
| enabled = enabled, | ||
| loading = loading, | ||
| icon = BpkIcon.ArrowRight, | ||
LokmaneKrizou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| position = BpkButtonIconPosition.Start, | ||
| onClick = { }, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @FigmaConnect("FIGMA_BUTTON") | ||
| @FigmaVariant(key = "Icon", value = "Right") | ||
| class BpkButtonRightIconCodeConnect { | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Style") | ||
| val type: BpkButtonType = Figma.mapping( | ||
| "Primary" to BpkButtonType.Primary, | ||
| "Secondary" to BpkButtonType.Secondary, | ||
| "Featured" to BpkButtonType.Featured, | ||
| "Destructive" to BpkButtonType.Destructive, | ||
| "Primary on Dark" to BpkButtonType.PrimaryOnDark, | ||
| "Primary on Light" to BpkButtonType.PrimaryOnLight, | ||
| "Secondary on Dark" to BpkButtonType.SecondaryOnDark, | ||
| "Link" to BpkButtonType.Link, | ||
| "Link on Dark" to BpkButtonType.LinkOnDark, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val enabled: Boolean = Figma.mapping( | ||
| "Normal" to true, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to true, | ||
| "Focused" to true, | ||
| "Hover" to true, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val loading: Boolean = Figma.mapping( | ||
| "Normal" to false, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to false, | ||
| "Focused" to false, | ||
| "Hover" to false, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Size") | ||
| val size: BpkButtonSize = Figma.mapping( | ||
| "Default" to BpkButtonSize.Default, | ||
| "Large" to BpkButtonSize.Large, | ||
| ) | ||
|
|
||
| @Composable | ||
| fun ComponentExample() { | ||
| BpkButton( | ||
| text = "Label", | ||
| type = type, | ||
| size = size, | ||
| enabled = enabled, | ||
| loading = loading, | ||
| icon = BpkIcon.ArrowRight, | ||
| position = BpkButtonIconPosition.End, | ||
| onClick = { }, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @FigmaConnect("FIGMA_BUTTON") | ||
| @FigmaVariant(key = "Icon", value = "Icon only") | ||
| class BpkButtonIconOnlyCodeConnect { | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Style") | ||
| val type: BpkButtonType = Figma.mapping( | ||
| "Primary" to BpkButtonType.Primary, | ||
| "Secondary" to BpkButtonType.Secondary, | ||
| "Featured" to BpkButtonType.Featured, | ||
| "Destructive" to BpkButtonType.Destructive, | ||
| "Primary on Dark" to BpkButtonType.PrimaryOnDark, | ||
| "Primary on Light" to BpkButtonType.PrimaryOnLight, | ||
| "Secondary on Dark" to BpkButtonType.SecondaryOnDark, | ||
| "Link" to BpkButtonType.Link, | ||
| "Link on Dark" to BpkButtonType.LinkOnDark, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val enabled: Boolean = Figma.mapping( | ||
| "Normal" to true, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to true, | ||
| "Focused" to true, | ||
| "Hover" to true, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "State") | ||
| val loading: Boolean = Figma.mapping( | ||
| "Normal" to false, | ||
| "Disabled" to false, | ||
| "Loading" to true, | ||
| "Pressed" to false, | ||
| "Focused" to false, | ||
| "Hover" to false, | ||
| ) | ||
|
|
||
| @FigmaProperty(FigmaType.Enum, "Size") | ||
| val size: BpkButtonSize = Figma.mapping( | ||
| "Default" to BpkButtonSize.Default, | ||
| "Large" to BpkButtonSize.Large, | ||
| ) | ||
|
|
||
| @Composable | ||
| fun ComponentExample() { | ||
| BpkButton( | ||
| icon = BpkIcon.ArrowRight, | ||
| contentDescription = "Label", | ||
| type = type, | ||
| size = size, | ||
| enabled = enabled, | ||
| loading = loading, | ||
| onClick = { }, | ||
| ) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those compostables are place holders to display snippet code in figma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compost😆