Skip to content
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

Combinations import done #1

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

AtomicScience
Copy link
Contributor

No description provided.

@AtomicScience
Copy link
Contributor Author

Основные фичи:

Открытие Сторибуков

Screen Shot 2022-02-03 at 11 57 29

Сначала Сторибуки должны быть добавлены через специальное меню - открывается нажатием на синюю кнопку снизу справа

Screen Shot 2022-02-03 at 14 07 46

@AtomicScience
Copy link
Contributor Author

Чтобы протестировать аддон, нужно запустить с ним локальный Сторибук

Это делается в пакете storybook-addon командой:

yarn start

@AtomicScience
Copy link
Contributor Author

Drag'n'drop

Перетаскивание компонентов на холст:
Screen Shot 2022-02-03 at 11 58 05

Предварительно, функция должны быть включена в тулбаре:
Screen Shot 2022-02-03 at 14 17 48

@AtomicScience
Copy link
Contributor Author

Генерация вариантов

Генерация вариантов на основе выбраных пропсов
Screen Shot 2022-02-03 at 12 47 49

Набор пропсов производится в панели:
Screen Shot 2022-02-03 at 14 29 08

Как и drag'n'drop, фича должна быть включена в тулбаре:
Screen Shot 2022-02-03 at 14 29 51

@AtomicScience
Copy link
Contributor Author

Импорт вариантов

Варианты можно импортировать нажатием кнопки:
Screen Shot 2022-02-03 at 14 35 31
Они появляются на холсте как компоненты:
Screen Shot 2022-02-03 at 13 53 42

packages/figma-plugin/src/figma.ts Outdated Show resolved Hide resolved
packages/figma-plugin/src/figma.ts Show resolved Hide resolved
packages/figma-plugin/src/figma.ts Show resolved Hide resolved
packages/storybook-addon/src/figma/commons.ts Outdated Show resolved Hide resolved
packages/storybook-addon/src/figma/sendSingleToFigma.ts Outdated Show resolved Hide resolved
packages/storybook-addon/src/figma/sendSingleToFigma.ts Outdated Show resolved Hide resolved
packages/storybook-addon/src/hooks/useCombinationRows.ts Outdated Show resolved Hide resolved
packages/storybook-addon/src/utils/generateCombinations.ts Outdated Show resolved Hide resolved
Copy link

@stenin-nikita stenin-nikita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Было бы неплохо, если бы в README было описано как это подключить, типо:

npm install storybook-to-figma-addon
// .storybook/main.js
module.exports = {
  // ...
  addons: ["storybook-to-figma-addon"],
};

Хотя бы самый минимум. Ну из мелочей - было бы здорово запустить prettier, чтобы привести код к единообразному виду. В целом есть еще места, где можно было бы типы получше описать, но это мелочи

@AlexStrNik
Copy link
Member

btw, а чего ты не conventional commits используешь?

@AlexStrNik
Copy link
Member

@axaxaman подскажи у нас тут есть автоматика для package.lock-а или его лучше коммитить?

@axaxaman
Copy link

axaxaman commented Feb 8, 2022

@axaxaman подскажи у нас тут есть автоматика для package.lock-а или его лучше коммитить?

Тут у нас нет никаких роботов, руками только

type : RequestType.GET,
timestamp: Date.now(),
payload: key,
} as FigmaStorageGetRequest;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А здесь и ниже точно нужен каст? Тут тайпскрипт без проблем должен типы резолвить

}
}

async function sendRequestAndExpectResult(request : FigmaRequest) : Promise<any | undefined> {
async function sendRequestAndExpectResult(request: FigmaStorageRequest): Promise<unknown | undefined> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А это по идее можно сделать женериком тогда каст на 26 строчке можно будет убрать

window.parent.postMessage({ pluginMessage: request }, "https://www.figma.com");
}

function createPromiseForRequestResult(request: FigmaRequest): Promise<any> {
function createPromiseForRequestResult(request: FigmaStorageRequest): Promise<any> {
return new Promise((resolve, reject) => {
window.addEventListener('message', (e) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А тут кажется есть проблема с тем что ивент листенеры не удаляются. Вообще я бы подумал над тем чтоб ивентлистенер создавался только один раз

P.S responce -> response

Comment on lines +21 to +22
this.storybooks = await this.figmaStorage.getItem("storybooks") as Storybook[];
this.selectedId = await this.figmaStorage.getItem("selectedId") as string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По идее тут тоже можно сделать дженерик чтоб не кастить, как по мне так красивее

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants