Skip to content
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

POC: Tailwind styled no code components #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timoconnellaus
Copy link

This is a PR for tailwind styled components including an example project

You can create tailwind styled components by adding a "tw" prop to the props object into the styles function. This works for arrays.

styles: ({ values }) => {
    const DummyCollectionStyles = values.DummyCollection.map(
      (dc: any) => `bg-[${dc.backgroundColorDummyCollection}]`
    );

    return {
      props: {
        tw: {
          Root: `bg-[${values.backgroundColor}] p-[${values.padding}]`,
          DummyCollectionOuterStyle:
            DummyCollectionStyles.length > 0
              ? DummyCollectionStyles
              : [undefined],
        },
      },
    };
  }

Responsiveness is handled using the tailwind convention where the default is mobile and exceptions are large screens. This doesn't change the way the editor is used where it is desktop first. The screen size prefixes are automatically calculated based on the responsive values selected

This feature does not include the generation of the tailwind CSS. That is handled by the application that is embedding easyblocks. However, there is an example of this working in the example apps - it uses a library that can render tailwind in the browser. The accomodate this there is an extension to the editor window API to include subscribe to updates - this is used to trigger the render of the CSS.

Copy link

vercel bot commented May 18, 2024

@timoconnellaus is attempting to deploy a commit to the Shopstory Team on Vercel.

A member of the Team first needs to authorize it.

@timoconnellaus timoconnellaus changed the title Tailwind styled no code components (feat) Tailwind styled no code components May 18, 2024
@timoconnellaus timoconnellaus changed the title (feat) Tailwind styled no code components Feat: Tailwind styled no code components May 18, 2024
@timoconnellaus timoconnellaus changed the title Feat: Tailwind styled no code components POC: Tailwind styled no code components May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant