Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

[DS-22] feature: implement line-box, refactor checkbox and radio-button #185

Merged
merged 7 commits into from
Aug 25, 2021

Conversation

ainursharaev
Copy link
Contributor

Link to issue

What have I done:

  • added box-line in boxes, created a formula for gaps inside box-lines
  • created the BoxLine component, that applies box-line for all direct children
  • refactored radio-button and checkboxes: used a new playground in usage docs, changed data-attributes to 'data-element' format, fixed some bugs

What have to be done:

  • agree on the new formula for box-line (gaps and vertical paddings)
  • agree on the new BoxLine component

padding-top: var(--local-vertical);
padding-bottom: var(--local-vertical);
}
padding-top: var(--local-vertical);
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: тут можно в одну строку + проверь что с горизонтальными паддингами происходит, чтобы браузер свои не добавил

&:focus [data-element='checkmark'] > svg,
&:active [data-element='checkmark'] > svg {
&:focus [data-element^='checkbox-'] > svg,
&:active [data-element^='checkbox-'] > svg {
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: тут название переменной должно быть var(--woly-focus-color)

input {
display: none;
}
margin-right: var(--local-gap);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: зачем выносить это сюда? лучше управление gaps зашить внутрь формулы linedox


outline: none;
}

[data-element='container'] {
display: flex;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: мб лучше это тоже зашить в формулу? элементы всегда будут расположены горизонтально, поэтому отдавать компоненту тут управление расположением наверно не имеет смысла

}
&:focus,
&:active {
--local-icon-fill: var(--woly-focus);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: название переменной цвета надо поправить


outline: none;

user-select: none;

&:focus [data-element='checkmark'] > svg,
&:active [data-element='checkmark'] > svg {
&:focus [data-element^='checkbox-'] > svg,
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: мб только на фокус оставим, как в radio-button?


export const Box = styled.div`
${box}
` as StyledComponent<'div', Record<string, unknown>>;

export const LineBox = styled.div`
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Можешь плиз подробнее рассказать о юзкейсах для этого компонента, какие проблемы он решает и т.д.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Мы экспортируем box-ы через такие обертки, чтобы пользователь мог использовать их в своих компонентах. К примеру, можно создать свои line-компоненты:

<LineBox>
  <Avatar />
  <Name />
<LineBox>

@ainursharaev ainursharaev force-pushed the feat/DS-22-implement-line-box branch from 6790922 to 916b1d6 Compare August 10, 2021 12:58
@ainursharaev ainursharaev marked this pull request as ready for review August 10, 2021 12:59
@@ -0,0 +1,15 @@
import { css } from 'styled-components';

export const visuallyHidden = css`
Copy link
Contributor

Choose a reason for hiding this comment

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

а что это за стили такие? почему через display none не скрыть?

Copy link
Contributor

Choose a reason for hiding this comment

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

согласна с Ромой, плюс отрицательный маргин использовать, как мне кажется, не очень хорошая затея

Copy link
Contributor Author

@ainursharaev ainursharaev Aug 11, 2021

Choose a reason for hiding this comment

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

Это для доступности. Подробнее можно прочитать тут

Copy link
Contributor

Choose a reason for hiding this comment

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

прикрепи плиз этот линк в комментарии к коду а то нифига не понятно

Copy link
Contributor

Choose a reason for hiding this comment

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

question: мб добавить эти стили в WolyGlobalStyles и юзать через атрибут data-visually-hidden?

@@ -0,0 +1,15 @@
import { css } from 'styled-components';

export const visuallyHidden = css`
Copy link
Contributor

Choose a reason for hiding this comment

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

согласна с Ромой, плюс отрицательный маргин использовать, как мне кажется, не очень хорошая затея

align-items: center;
justify-content: center;
}

input:checked ~ [data-element='checkbox-checked'] {
svg > rect {
fill: var(--local-icon-fill);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: цвет на 130 строке должен быть var(--woly-focus-color)

checked={checked}
onChange={onChange}
onKeyDown={onKeyDown}
disabled={disabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: мне кажется не очень ок прокидывать 2 disabled в компонент, но можем обсудить это командой, мне кажется, есть более удобное решение

Copy link
Contributor Author

@ainursharaev ainursharaev Aug 11, 2021

Choose a reason for hiding this comment

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

Закинул вопрос на обсуждение

Irinaristova
Irinaristova previously approved these changes Aug 25, 2021
sergeysova
sergeysova previously approved these changes Aug 25, 2021
)}
</State>
</Playground>
```tsx playground

Choose a reason for hiding this comment

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

praise: респект)

risen228
risen228 previously approved these changes Aug 25, 2021
@ainursharaev ainursharaev force-pushed the feat/DS-22-implement-line-box branch from cd100e9 to 9b2b784 Compare August 25, 2021 14:08
@Irinaristova Irinaristova merged commit f6a9244 into master Aug 25, 2021
@Irinaristova Irinaristova deleted the feat/DS-22-implement-line-box branch August 25, 2021 14:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@atoms Changes inside atoms @molecules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants