1- import { CSSProperties } from "react" ;
2- import "./HeaderBar.scss" ;
31import useSystemSettings from "../../stores/systemSettingsStore" ;
42
3+ import { StyledHeaderBar } from "./styles" ;
4+
55interface HeaderBarProps {
66 header : string ;
77 position ?: "left" | "centre" | "right" ;
@@ -20,37 +20,18 @@ function HeaderBar({
2020 borderRadiusBottom = 10 ,
2121} : HeaderBarProps ) {
2222 const settings = useSystemSettings ( ) ;
23- function getJustifyContent ( ) : CSSProperties [ "justifyContent" ] {
24- switch ( position ) {
25- case "left" :
26- return "flex-start" ;
27- case "right" :
28- return "flex-end" ;
29- case "centre" :
30- default :
31- return "center" ;
32- }
33- }
23+
3424 return (
35- < div
36- className = "header-bar__container"
37- style = { {
38- display : "flex" ,
39- alignItems : "center" ,
40- justifyContent : getJustifyContent ( ) ,
41- paddingTop : padVertical ,
42- paddingBottom : padVertical ,
43- paddingLeft : padHorizontal ,
44- paddingRight : padHorizontal ,
45- backgroundColor : settings . mainColor ,
46- borderTopLeftRadius : borderRadiusTop ,
47- borderTopRightRadius : borderRadiusTop ,
48- borderBottomLeftRadius : borderRadiusBottom ,
49- borderBottomRightRadius : borderRadiusBottom ,
50- } }
25+ < StyledHeaderBar
26+ backgroundColor = { settings . mainColor }
27+ position = { position }
28+ padVertical = { padVertical }
29+ padHorizontal = { padHorizontal }
30+ borderRadiusTop = { borderRadiusTop }
31+ borderRadiusBottom = { borderRadiusBottom }
5132 >
5233 < span className = "header-bar__header" > { header } </ span >
53- </ div >
34+ </ StyledHeaderBar >
5435 ) ;
5536}
5637
0 commit comments