Giter Site home page Giter Site logo

add transform support about tailwindcss-rtl HOT 6 OPEN

20lives avatar 20lives commented on May 27, 2024 2
add transform support

from tailwindcss-rtl.

Comments (6)

20lives avatar 20lives commented on May 27, 2024 5

I understand the use case,
I will consider adding this.

from tailwindcss-rtl.

AnasSafi avatar AnasSafi commented on May 27, 2024 1

I solve this problem by this way from documentation :
To use a negative translate value, prefix the class name with a dash to convert it to a negative value.
So you can use class:
-translate-y-6 to translate from right to left
And:
translate-y-6 to translate from left to right

from tailwindcss-rtl.

20lives avatar 20lives commented on May 27, 2024

Hi,
I don't think this is actually how it should work.
https://tailwindcss.com/docs/translate

the translation parameter is the axis (Y or X) so there is no left/right or start/end.

from tailwindcss-rtl.

sbc640964 avatar sbc640964 commented on May 27, 2024

Try to imagine this switch:

function Switcher(props)
{
    const {
        checked,
        enabledLabel,
        disabledLabel,
        label,
        onChange,
        errors,
        name,
        description
    } = props;

    return(
        <>
            {label &&
                <div className="font-medium text-gray-700 text-sm">
                    {label}
                </div>
            }
            <div className="mt-1 flex rounded-md">

                <div
                    className={`relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:shadow-outline ${checked ? 'bg-primary-600' : 'bg-gray-200'}`}
                    aria-checked="false"
                    role="checkbox"
                    tabIndex={0}
                    onClick={onChange}
                >
                    <div
                        className={`inline-block h-5 w-5 rounded-full bg-white shadow transform transition ease-in-out duration-200 ${checked ? '-translate-x-5' : '-translate-x-0'}`}
                        aria-hidden="true"
                    >
                    </div>
                </div>
                <div className="ms-3 text-sm text-gray-600">
                    {checked
                        ? <small>{enabledLabel}</small>
                        : <small>{disabledLabel}</small>
                    }
                </div>
            </div>
            {errors &&
                <Error errors={errors}/>
            }
            {description &&
                <Description>{description}</Description>
            }
        </>
    )
}

export default Switcher;

The position on the X axis (left or right) varies depending on the direction.

from tailwindcss-rtl.

sbc640964 avatar sbc640964 commented on May 27, 2024

@20lives Thank you!

from tailwindcss-rtl.

samjohnduke avatar samjohnduke commented on May 27, 2024

I know this issue is a little old. But i ran into the same issue, but on further inspection there is a rtl: variant in tailwind (might be new?) so you can just do the opposite transform if you need to.

from tailwindcss-rtl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.