Skip to content

Commit 4705b09

Browse files
committed
feat(utils): changed the default @include order for easier overrides
The new @include order from the main `@mixin react-md-utils` will make it so that styles can be overridden more easily by other packages or consumers of this library. I had just done alphabetical order before, but it makes more sense to order by feature set since the styles for this library should be last-import-preference order. i.e. import '~react-md/dist/react-md'; .my-class { // this should override any styles from react-md without !important // ... well, if they have the same selector precedence }
1 parent 6a206a4 commit 4705b09

File tree

1 file changed

+65
-67
lines changed

1 file changed

+65
-67
lines changed

packages/utils/src/_mixins.scss

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -716,18 +716,18 @@
716716
/// }
717717
/// }
718718
@mixin rmd-utils-dense {
719-
@if mixin-exists(rmd-app-bar-dense-theme) {
720-
@include rmd-app-bar-dense-theme;
721-
}
722-
723-
@if mixin-exists(rmd-toggle-dense-theme) {
724-
@include rmd-toggle-dense-theme;
719+
@if mixin-exists(rmd-tooltip-dense-theme) {
720+
@include rmd-tooltip-dense-theme;
725721
}
726722

727723
@if mixin-exists(rmd-icon-dense-theme) {
728724
@include rmd-icon-dense-theme;
729725
}
730726

727+
@if mixin-exists(rmd-app-bar-dense-theme) {
728+
@include rmd-app-bar-dense-theme;
729+
}
730+
731731
@if mixin-exists(rmd-list-dense-theme) {
732732
@include rmd-list-dense-theme;
733733
}
@@ -736,8 +736,8 @@
736736
@include rmd-list-item-dense-theme;
737737
}
738738

739-
@if mixin-exists(rmd-tooltip-dense-theme) {
740-
@include rmd-tooltip-dense-theme;
739+
@if mixin-exists(rmd-toggle-dense-theme) {
740+
@include rmd-toggle-dense-theme;
741741
}
742742
}
743743

@@ -749,119 +749,117 @@
749749
@include rmd-utils-base;
750750
@include react-md-utils-grid;
751751

752-
@if mixin-exists(react-md-alert) {
753-
@include react-md-alert;
752+
// the mixins are added in this specific order to make overriding easier
753+
@if mixin-exists(react-md-theme) {
754+
@include react-md-theme;
754755
}
755756

756-
@if mixin-exists(react-md-avatar) {
757-
@include react-md-avatar;
757+
@if mixin-exists(react-md-typography) {
758+
@include react-md-typography;
758759
}
759760

760-
@if mixin-exists(react-md-badge) {
761-
@include react-md-badge;
761+
@if mixin-exists(react-md-transition) {
762+
@include react-md-transition;
762763
}
763764

764-
@if mixin-exists(react-md-button) {
765-
@include react-md-button;
765+
@if mixin-exists(react-md-states) {
766+
@include react-md-states;
766767
}
767768

768-
// has to come after buttons since it overrides some button styles
769-
@if mixin-exists(react-md-app-bar) {
770-
@include react-md-app-bar;
769+
@if mixin-exists(react-md-tooltip) {
770+
@include react-md-tooltip;
771771
}
772772

773-
@if mixin-exists(react-md-overlay) {
774-
@include react-md-overlay;
773+
@if mixin-exists(react-md-divider) {
774+
@include react-md-divider;
775775
}
776776

777-
// has to come after overlays since it overrides the z-index
778-
@if mixin-exists(react-md-dialog) {
779-
@include react-md-dialog;
777+
@if mixin-exists(react-md-icon) {
778+
@include react-md-icon;
780779
}
781780

782-
@if mixin-exists(react-md-card) {
783-
@include react-md-card;
781+
@if mixin-exists(react-md-avatar) {
782+
@include react-md-avatar;
784783
}
785784

786-
@if mixin-exists(react-md-chip) {
787-
@include react-md-chip;
785+
@if mixin-exists(react-md-media) {
786+
@include react-md-media;
788787
}
789788

790-
@if mixin-exists(react-md-divider) {
791-
@include react-md-divider;
789+
@if mixin-exists(react-md-link) {
790+
@include react-md-link;
792791
}
793792

794-
@if mixin-exists(react-md-expansion-panel) {
795-
@include react-md-expansion-panel;
793+
@if mixin-exists(react-md-overlay) {
794+
@include react-md-overlay;
796795
}
797796

798-
@if mixin-exists(react-md-form) {
799-
@include react-md-form;
797+
@if mixin-exists(react-md-progress) {
798+
@include react-md-progress;
800799
}
801800

802-
@if mixin-exists(react-md-icon) {
803-
@include react-md-icon;
801+
@if mixin-exists(react-md-button) {
802+
@include react-md-button;
804803
}
805804

806-
@if mixin-exists(react-md-link) {
807-
@include react-md-link;
805+
@if mixin-exists(react-md-badge) {
806+
@include react-md-badge;
808807
}
809808

810-
@if mixin-exists(react-md-list) {
811-
@include react-md-list;
809+
@if mixin-exists(react-md-chip) {
810+
@include react-md-chip;
812811
}
813812

814-
@if mixin-exists(react-md-media) {
815-
@include react-md-media;
813+
@if mixin-exists(react-md-alert) {
814+
@include react-md-alert;
816815
}
817816

818-
@if mixin-exists(react-md-menu) {
819-
@include react-md-menu;
817+
@if mixin-exists(react-md-app-bar) {
818+
@include react-md-app-bar;
820819
}
821820

822-
@if mixin-exists(react-md-progress) {
823-
@include react-md-progress;
821+
@if mixin-exists(react-md-card) {
822+
@include react-md-card;
824823
}
825824

826-
@if mixin-exists(react-md-sheet) {
827-
@include react-md-sheet;
825+
@if mixin-exists(react-md-expansion-panel) {
826+
@include react-md-expansion-panel;
828827
}
829828

830-
// has to come after sheet
831-
@if mixin-exists(react-md-layout) {
832-
@include react-md-layout;
829+
@if mixin-exists(react-md-list) {
830+
@include react-md-list;
833831
}
834832

835-
@if mixin-exists(react-md-states) {
836-
@include react-md-states;
833+
@if mixin-exists(react-md-dialog) {
834+
@include react-md-dialog;
837835
}
838836

839-
@if mixin-exists(react-md-table) {
840-
@include react-md-table;
837+
@if mixin-exists(react-md-menu) {
838+
@include react-md-menu;
841839
}
842840

843-
@if mixin-exists(react-md-tabs) {
844-
@include react-md-tabs;
841+
@if mixin-exists(react-md-sheet) {
842+
@include react-md-sheet;
845843
}
846844

847-
@if mixin-exists(react-md-theme) {
848-
@include react-md-theme;
845+
@if mixin-exists(react-md-tabs) {
846+
@include react-md-tabs;
849847
}
850848

851-
@if mixin-exists(react-md-tooltip) {
852-
@include react-md-tooltip;
849+
@if mixin-exists(react-md-tree) {
850+
@include react-md-tree;
853851
}
854852

855-
@if mixin-exists(react-md-transition) {
856-
@include react-md-transition;
853+
@if mixin-exists(react-md-table) {
854+
@include react-md-table;
857855
}
858856

859-
@if mixin-exists(react-md-tree) {
860-
@include react-md-tree;
857+
@if mixin-exists(react-md-form) {
858+
@include react-md-form;
861859
}
862860

863-
@if mixin-exists(react-md-typography) {
864-
@include react-md-typography;
861+
@if mixin-exists(react-md-layout) {
862+
@include react-md-layout;
865863
}
866864

867865
@if $rmd-utils-auto-dense {

0 commit comments

Comments
 (0)