question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Add emotion position function types

See original GitHub issue

Package Scope

  • Add to an existing package
  • New package

Package name: react/emotion-utils

Overview

I want to like code like this position({top:10,bottom:8}) But position function did not support this type.

Describe the solution you’d like

I want to add this code.

export function position(coordinates: Coordinates): SerializedStyles;`

  const [top, right, bottom, left] = (() => {
    // position(coordinates)
    if (typeof positionOrTopOrCoordinates === 'object') {
      return [
        positionOrTopOrCoordinates.top,
        positionOrTopOrCoordinates.right,
        positionOrTopOrCoordinates.bottom,
        positionOrTopOrCoordinates.left,
      ];
    }

and test code

  it('position({top: 0, left: 0})', () => {
    const { getByTestId } = render(<div data-testid="test" css={position({ top: 0, left: 0 })} />);

    const el = getByTestId('test');

    expect(el).toBeInTheDocument();

    expect(el).toHaveStyleRule('top', '0');
    expect(el).not.toHaveStyleRule('bottom', '0');
    expect(el).not.toHaveStyleRule('right', '0');
    expect(el).toHaveStyleRule('left', '0');
  });

Additional context

I think toss team may not agree my opinion. So I open an issue, not pr. Thank you

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
HoseungJangcommented, Nov 2, 2022
  1. I think we can just support absolute, fixed and sticky. Because other values are not used with top, left, right and bottom in general.
  2. I think it would be great to support the both interfaces.
2reactions
HoseungJangcommented, Nov 1, 2022

Thanks. Take your time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to insert styles at a specific position in <head> #2037
The problem I see that @emotion/cache provides a container option, which seems like it's useful for having some control over the DOM element ......
Read more >
Emotion – Introduction
Emotion is a library designed for writing css styles with JavaScript. It provides powerful and predictable style composition in addition to a great ......
Read more >
Compound facial expressions of emotion - PNAS
Past research on facial expressions of emotion has focused on the study of six basic categories—happiness, surprise, anger, sadness, fear, and ...
Read more >
Emotion Regulation through Movement: Unique Sets of ...
In conclusion, our study has identified sets of motor characteristics that predict the elicitation or enhancement of each of the emotions: anger ...
Read more >
What Is an Interjection Word? Function, Examples, & Types
The definition of an interjection is a word (or short phrase) whose function is to insert excitement, or another strong emotion, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found