-
Notifications
You must be signed in to change notification settings - Fork 20
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
plasma-web/plasma-b2c: Добавлена сборка без styled-components #942
Conversation
@@ -11,4 +10,4 @@ const SpinnerComponent = component(mergedConfig) as React.FunctionComponent<Spin | |||
/** | |||
* Компонент для отображения индикатора загрузки. | |||
*/ | |||
export const Spinner = styled(SpinnerComponent)``; | |||
export const Spinner = SpinnerComponent; |
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.
@neretin-trike напомни зачем тут это нужно было
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.
ну он в styled был обёрнут (и раньше так было, до перевода на новую архитектуру) для того, чтобы не сломалось у тех, кто возможно стилизовал Spinner через styled-component и обращался к нему как классу, типа:
const StyledWrapper = styled.div`
${Spinner} {
background: blue
}
`
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.
Блин чёт я не понимаю тогда как это разрулить :/
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.
Я это проверил, и это работает только через styled от SC. Так что на линарии этот функционал не будет работать. Пруф
CC: @Yeti-or @neretin-trike
Theme Builder app deployed! http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-942/ |
⚡ Component performance testingResult: 🟢 OK |
Documentation preview deployed! website: http://plasma.sberdevices.ru/pr/pr-942/ |
Theme Builder app deployed! http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-942/ |
976f614
to
0562dab
Compare
Theme Builder app deployed! http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-942/ |
0562dab
to
d25dac8
Compare
Theme Builder app deployed! http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-942/ |
Documentation preview deployed! website: http://plasma.sberdevices.ru/pr/pr-942/ |
@@ -30,3 +30,6 @@ done; | |||
# plasma-new-hope/styled-components => plasma-new-hope | |||
perl -p -i -e "s/\/styled-components//g" $files | |||
|
|||
#TODO: #1024 удалить обертку styled в спиннере | |||
perl -p -i -e "s/import styled from 'styled-components';//g" src-css/components/Spinner/Spinner.tsx | |||
perl -p -i -e "s/styled\(SpinnerComponent\)\`\`/SpinnerComponent/g" src-css/components/Spinner/Spinner.tsx |
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.
ааа ты тут просто удаляешь обертку и в линарии идет FunctionComponent
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.
В линарии идет сразу компонент, без styled, ибо он запрещен в рантайме и это в принципе бессмысленно.
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.
а в итоге так нельзя будет сделать через компонент, который собрался линарией?
const StyledWrapper = styled.div`
${Spinner} {
background: blue
}
`
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.
Думаю, что да, но зачем нам это?
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.
ну это нужно было проверить, чтобы убедиться, что у пользователей, которые вот таким образом спиннер стилизуют, поменяв путь с plasma-b2c на plasma-b2c/css, не сломается сборка
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.
А зачем ребятам на sc импортировать /css сборку? Мы же сделали этот фикс, чтобы спиннер был обернут в styled из sc, чтобы на сборке на стайледах все было по-прежнему.
ну когда мы обсуждали это, то как раз пришли к такому мнению, что те, кто будут постепенно переезжать с styled-compoennts на линарию, будут иметь и те, и другие импорты (и зависимости)
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.
А сборку /css будут юзать те, у кого нет sc (хотя таковых на данный момент нет). И там я не вижу смысла оборачивать именно Спиннер в styled из линарии, ибо зачем?
не, я и не говорю, что оборачивать нужно. Но нужно убедиться, что у пользователей не будет проблем с обратной совместимостью уже существующих компонент
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.
А, ну эти проблемы точно будут, и потребуют ручного устранения, ибо конструкция
${Spinner} { background: blue }
ожидает только styled-подобный компонент из SC, и ни стайлед от линарии, ни обычный react.element как минимум не пройдут проверку типов, а если и пройдут, то работать это не будет.
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.
а такая конструкция валидна только для styled.tagname
компонент получается? 🤔
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.
Это вполне валидный паттерн, как для SC так и для линарии. https://github.com/callstack/linaria/blob/master/docs/BASICS.md#referring-to-another-component-or-class-name
9d52882
to
faa2c1f
Compare
Theme Builder app deployed! http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-942/ |
Documentation preview deployed! website: http://plasma.sberdevices.ru/pr/pr-942/ |
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.
Давайте вольем текущее состояние а дальше будем править уже по мере проблем
touch src-css/index.ts | ||
touch src-css/index.d.ts | ||
for component in $components; do | ||
if [[ "$component" != "Switch" ]]; then |
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.
Решили пока оставить так, в этом issue нужно будет потом починить
🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀 |
🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀 |
1 similar comment
🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀 |
Добавили возможность использовать
plasma-web
&plasma-b2c
безstyled-components
Пример использования:
What/why changed
Добавлены скрипты которые генерируют нужную структуру из тех компонентов которые есть в plasma-new-hope
дальше подрубаемся rollup и генерируем стили
📦 Published PR as canary version:
Canary Versions
✨ Test out this PR locally via: