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

feat(plasma-new-hope): add emotion support #1276

Merged
merged 1 commit into from
Jul 2, 2024
Merged

feat(plasma-new-hope): add emotion support #1276

merged 1 commit into from
Jul 2, 2024

Conversation

Yeti-or
Copy link
Contributor

@Yeti-or Yeti-or commented Jul 1, 2024

Support emotion engine

  • добавлена поддержка пакета @emotion

What/why changed

Для поддержки пакет @emotion расширили возможности в пакете plasma-new-hope

В целом алгоритм такой же как и с работой styled-components.

Делаем копию списка компонентов и заменяем использование пакетов

import { styled } from '@linaria/react' //-> @emotion/styled
import { css } from '@linaria/core' // -> @emotion/react

И появилась новая директория emotion на уровне самого пакета поставки

Screenshot 2024-07-02 at 18 26 05
📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
# or 
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]

Copy link
Contributor

github-actions bot commented Jul 1, 2024

Theme Builder app deployed!

https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-1276/

Copy link
Contributor

github-actions bot commented Jul 1, 2024

⚡ Component performance testing

Result: 🟢 OK

Copy link
Contributor

github-actions bot commented Jul 1, 2024

⚡ Component performance testing

Result: 🟢 OK

@@ -94,7 +95,7 @@ export { addFocus }
// @public (undocumented)
export const BodyL: FunctionComponent<PropsType< {
size: {
l: string;
l: PolymorphicClassName;
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Note]:

Изменения связанные с тем как описывают типы пакеты @emotion/react и @linaria

для @linaria это просто string, то для @emotion/react

export interface SerializedStyles {
    name: string;
    styles: string;
    map?: string;
    next?: SerializedStyles;
}

export type PolymorphicClassName = string | SerializedStyles; 

поэтому запись стало такой

Copy link
Collaborator

Choose a reason for hiding this comment

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

В файле - packages/plasma-new-hope/src/engines/types.ts находятся эти изменения.

Copy link
Contributor

github-actions bot commented Jul 2, 2024

⚡ Component performance testing

Result: 💀 WASTED

Performance tests are broken.
If the current changes are the cause, please fix it immediately in this PR. If not, please schedule their repair.
For any questions, come to the Speed team.

@@ -0,0 +1,5 @@
{
"module": "es/index.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Сделано по аналогии со styled-components

У нас так же есть суб директория - packages/plasma-new-hope/styled-components в которой лежит package.json с точно таким же описанием.

Copy link
Contributor

github-actions bot commented Jul 2, 2024

⚡ Component performance testing

Result: 🟢 OK

@Yakutoc
Copy link
Collaborator

Yakutoc commented Jul 2, 2024

@Yakutoc Yakutoc marked this pull request as ready for review July 2, 2024 12:13
Copy link
Contributor

github-actions bot commented Jul 2, 2024

⚡ Component performance testing

Result: 🟢 OK

@@ -9,6 +9,7 @@ perl -p -i -e "s/import { styled } from '\@linaria\/react'/import styled from 's
perl -p -i -e "s/import { css } from '\@linaria\/core'/import { css } from 'styled-components'/g" $files

rm -rf src-sc/engines/linaria.tsx
perl -p -i -e "s/import { css as cssLibrary } from '\@linaria\/core'/import { css as cssLibrary } from 'styled-components'/g" src-sc/engines/index.ts
perl -p -i -e "s/linaria/styled-components/g" src-sc/engines/index.ts src-sc/engines/common.tsx
rm -rf src-sc/engines/emotion.tsx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@Yeti-or Yeti-or added this pull request to the merge queue Jul 2, 2024
Merged via the queue into dev with commit 581bcc2 Jul 2, 2024
29 checks passed
@Yeti-or Yeti-or deleted the yeti-or.emotion branch July 2, 2024 13:25
This was referenced Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants