Skip to content

Commit

Permalink
Merge pull request #13 from makamekm/develop
Browse files Browse the repository at this point in the history
Midnight fixes
  • Loading branch information
makamekm authored Feb 23, 2020
2 parents 6407702 + 96abcdb commit 5d7a4f3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/npm_notify_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Node.js Public Release Notes

on:
release:
push:
tags:
- 'v*'

jobs:
test_develop:
Expand All @@ -12,11 +14,12 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Extract tag name
id: tag
uses: actions/github-script@0.2.0
uses: actions/github-script@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
return context.payload.ref.replace(/\/refs\/tags\//, '');
return context.payload.ref.replace(/refs\/tags\//, '');
- name: send release notes
uses: appleboy/telegram-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion content.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function setComponentFromCache(state, shared) {

function renderVector(state, { imgMap, genClassName, additionalStyles }) {
const { node, content } = state;
if (node.type === 'VECTOR') {
if (node.type === 'VECTOR' && imgMap[node.id]) {
emptyChildren(state);

const currentClass = genClassName();
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ async function runFigmaReact(options = {}) {
const pngImages = await loadURLPNGImages(fileKey, headers);

// Debug
const fs = require('fs');
fs.writeFileSync('./temp.json', JSON.stringify(canvas, null, 4));
// const fs = require('fs');
// fs.writeFileSync('./temp.json', JSON.stringify(canvas, null, 4));

// Create components
await createComponents(canvas, {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "figma-react",
"description": "This is a tool to help you export Figma project into React mockups",
"version": "1.0.10",
"version": "1.0.11",
"private": false,
"author": "Maxim Karpov <[email protected]>",
"repository": {
Expand Down
18 changes: 10 additions & 8 deletions style.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ function setMiddleOrder({ node, middleStyle }) {
}
}

function setTransformation({ middleStyle, bounds }) {
if (bounds && Math.abs(bounds.angle) > 0.01) {
middleStyle.transform = `rotate(${-bounds.angle}deg)`;
middleStyle.transformOrigin = '50% 50%';
function setTransformation({ middleStyle, bounds, node }) {
if (node.type !== 'VECTOR') {
if (bounds && Math.abs(bounds.angle) > 0.01) {
middleStyle.transform = `rotate(${-bounds.angle}deg)`;
middleStyle.transformOrigin = '50% 50%';
}
}
}

Expand Down Expand Up @@ -206,8 +208,9 @@ async function setFrameStyles(state, { pngImages, headers, options }) {
middleStyle.backgroundColor = colorString(node.backgroundColor);
if (node.clipsContent) middleStyle.overflow = 'hidden';
} else if (node.type === 'RECTANGLE') {
// TODO: Foreach fills
const lastFill = getPaint(node.fills);
if (lastFill) {
if (lastFill && lastFill.visible !== false) {
if (lastFill.type === 'SOLID') {
middleStyle.backgroundColor = colorString(lastFill.color);
middleStyle.opacity = lastFill.opacity;
Expand All @@ -233,9 +236,8 @@ async function setFrameStyles(state, { pngImages, headers, options }) {
middleStyle.backgroundSize = `${lastFill.scalingFactor * imageSize.width}px ${lastFill.scalingFactor * imageSize.height}px`;
} else if (lastFill.scaleMode === 'STRETCH') {
middleStyle.backgroundRepeat = 'no-repeat';
middleStyle.backgroundSize = `${imageSize.width}px ${imageSize.height}px`;
middleStyle.backgroundPosition = `-${imageSize.width * lastFill.imageTransform[0][2]}px -${imageSize.height *
lastFill.imageTransform[1][2]}px`;
middleStyle.backgroundSize = 'cover';
middleStyle.backgroundPosition = `${100 * lastFill.imageTransform[0][2]}% ${100 * lastFill.imageTransform[1][2]}%`;
}
} else if (lastFill.type === 'GRADIENT_LINEAR') {
middleStyle.background = paintToLinearGradient(lastFill);
Expand Down

0 comments on commit 5d7a4f3

Please sign in to comment.