4

I'm trying to create a custom theme for ExtJS 4, more complex that just changing the base color. So probably this is more a question about SASS than the theme itself.

ExtJS declares mixins for all its components, but for many of these the mixin has no parameters.

@mixin extjs-menu {
  .#{$prefix}menu-body {
      @include no-select;
      background: $menu-background-color !important;
      padding: $menu-padding;
  }
  ...
}

For example, this is the menu mixin. As you can see, they are not using mixin parameters; instead, they are using the global variables that affect all menus.

So to modify this component I was doing the following:

$menu-background-color: red;
@include ext-menu

But what happens when you have several menus in your app and you want different looks for each. Any ideas?

My idea was to create a mixin with my changes and call the ext-menu mixin, but I'm not sure if declaring $menu-background-color: red inside the mixin will affect the global variable or not.

1 Answer 1

1

In you .sass file, do something like this:

.my-menu {
  @include extjs-menu;
}

In your JS code, just assign cls: 'my-menu' to the Ext.menu.Menu.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.