Skip to content

mixin as a function result? #376

@a-dominiak

Description

@a-dominiak

Hey, we have a following case.
We have an existing styled-components app which theme's has function for calculating spaces eg.

import styled from 'styled-components'

const Text = styled.div`
  ${({ theme }) => theme.getFluidSpacing('padding-left', 'equal', 0)}
`

What would be a replacement in next-yak?
I've tried following:

import {styled, css} from 'next-yak'
import { theme } from '@theme/main'
const spacing = css`${theme.getFluidSpacing('padding-left', 'equal', 0)}`

const Text = styled.div`
  ${spacing}
`

and it doesn't work. It shows the given css as classname, not as style.

<div class="index_Text__giUSk 
    padding-left: 4rem;

    @media screen and (min-width: 20em) {
      padding-left: calc(4rem + 0 * ((100vw - 176rem) / -144));;
    }

    @media screen and (min-width: 110em) {
      padding-left: 4rem;
    }
  ">Home Page</div>

How should it be done?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions