-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Theming): Use UI5 Web Components CSS Variables (#46)
- Loading branch information
1 parent
2db741f
commit ce2aed9
Showing
29 changed files
with
1,428 additions
and
2,247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { writeFileSync } = require('fs'); | ||
const { _: Fiori3ThemingVariables } = require('@ui5/webcomponents/dist/themes/sap_fiori_3/parameters-bundle.css.json'); | ||
|
||
const variables = Fiori3ThemingVariables.replace(':root{', '') | ||
.replace(/}$/, '') | ||
.split(';') | ||
.filter((variable) => !/^--_?ui5/.test(variable)) | ||
.map((value) => value.split(':')[0]); | ||
|
||
let fileContent = `/* | ||
* ### WARNING ### | ||
* This is an autogenerated file, do not change manually. | ||
* In order to recreate this file, please run 'node packages/base/scripts/cssVariables/parse.js' | ||
*/ | ||
`; | ||
|
||
for (const variable of variables) { | ||
fileContent += `export const ${variable.replace('--', '')} = 'var(${variable});';\n`; | ||
} | ||
|
||
writeFileSync('test.ts', fileContent); |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { Event, fonts, StyleClassHelper, withStyles } from '@ui5/webcomponents-react-base'; | ||
import { JSSTheme } from '../../interfaces/JSSTheme'; | ||
|
||
const anchorButtonStyles = ({ parameters }: JSSTheme) => ({ | ||
button: { | ||
color: parameters.sapUiContentLabelColor, | ||
fontFamily: fonts.sapUiFontFamily, | ||
fontSize: fonts.sapMFontMediumSize | ||
}, | ||
selected: { | ||
color: parameters.sapUiSelected, | ||
minWidth: '2rem', | ||
textAlign: 'center', | ||
'&:after': { | ||
content: '""', | ||
borderBottom: `0.188rem solid ${parameters.sapUiSelected}`, | ||
width: '100%', | ||
position: 'absolute', | ||
bottom: 0, | ||
left: 0 | ||
} | ||
} | ||
}); | ||
|
||
export const AnchorButton = withStyles(anchorButtonStyles)(({ onClick, children, classes, selected }) => { | ||
const classNames = StyleClassHelper.of(classes.button); | ||
if (selected) { | ||
classNames.put(classes.selected); | ||
} | ||
|
||
const eventWrapper = (e) => { | ||
onClick(Event.of(null, e, { text: true })); | ||
}; | ||
|
||
return ( | ||
<span onClick={eventWrapper} className={classNames.valueOf()}> | ||
{children} | ||
</span> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.