Skip to content

Commit

Permalink
Refactor #4530
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Oct 4, 2023
1 parent 4ec4952 commit 877d6c0
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 30 deletions.
16 changes: 10 additions & 6 deletions components/lib/base/style/BaseStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ export default {
classes,
inlineStyles,
loadStyle(options = {}) {
return useStyle(this.css, { name: this.name, ...options });
return this.css ? useStyle(this.css, { name: this.name, ...options }) : {};
},
getStyleSheet(extendedCSS = '', props = {}) {
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
if (this.css) {
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');

return `<style type="text/css" data-primevue-style-id="${this.name}" ${_props}>${this.css}${extendedCSS}</style>`;
return `<style type="text/css" data-primevue-style-id="${this.name}" ${_props}>${this.css}${extendedCSS}</style>`;
}

return '';
},
extend(style) {
return { ...this, ...style };
return { ...this, css: undefined, ...style };
}
};
3 changes: 1 addition & 2 deletions components/lib/button/style/ButtonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ const classes = {

export default BaseStyle.extend({
name: 'button',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/card/style/CardStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ const classes = {

export default BaseStyle.extend({
name: 'card',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/checkbox/style/CheckboxStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ const classes = {

export default BaseStyle.extend({
name: 'checkbox',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/confirmdialog/style/ConfirmDialogStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ const classes = {

export default BaseStyle.extend({
name: 'confirmdialog',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/dataview/style/DataViewStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ const classes = {

export default BaseStyle.extend({
name: 'dataview',
classes,
loadStyle: () => {}
classes
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ const classes = {

export default BaseStyle.extend({
name: 'dataviewlayoutoptions',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/inputmask/style/InputMaskStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ const classes = {

export default BaseStyle.extend({
name: 'inputmask',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/inputtext/style/InputTextStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ const classes = {

export default BaseStyle.extend({
name: 'inputtext',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/radiobutton/style/RadioButtonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ const classes = {

export default BaseStyle.extend({
name: 'radiobutton',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/selectbutton/style/SelectButtonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ const classes = {

export default BaseStyle.extend({
name: 'selectbutton',
classes,
loadStyle: () => {}
classes
});
3 changes: 1 addition & 2 deletions components/lib/togglebutton/style/ToggleButtonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ const classes = {

export default BaseStyle.extend({
name: 'accordion',
classes,
loadStyle: () => {}
classes
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ const classes = {

export default BaseStyle.extend({
name: 'tristatecheckbox',
classes,
loadStyle: () => {}
classes
});

0 comments on commit 877d6c0

Please sign in to comment.