-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rework icons - rework settings - rework ListViewBuilder
- Loading branch information
Der_Googler
committed
Jun 8, 2022
1 parent
28e45e8
commit 6637f75
Showing
4 changed files
with
66 additions
and
70 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,37 @@ | ||
import { OverridableComponent } from "@mui/material/OverridableComponent"; | ||
import { SvgIconProps, SvgIconTypeMap } from "@mui/material/SvgIcon"; | ||
import SharedPreferences, { ISharedPreferences } from "@Native/SharedPreferences"; | ||
import { Component } from "react"; | ||
|
||
interface IProps { | ||
icon: OverridableComponent<SvgIconTypeMap>; | ||
/** | ||
* Keeps the icons in light colors even if it's dark mode on | ||
*/ | ||
keepLight?: boolean; | ||
} | ||
|
||
/** | ||
* An icon wrapper for Material React icons | ||
*/ | ||
class Icon extends Component<IProps & SvgIconProps> { | ||
private pref: ISharedPreferences; | ||
private isDarkmode: boolean; | ||
public constructor(props: (IProps & SvgIconProps) | Readonly<IProps & SvgIconProps>) { | ||
super(props); | ||
this.pref = new SharedPreferences(); | ||
this.isDarkmode = this.pref.getBoolean("enableDarkmode", false); | ||
} | ||
|
||
public render() { | ||
const { keepLight } = this.props; | ||
return ( | ||
<this.props.icon | ||
sx={{ color: this.isDarkmode ? (keepLight ? "rgba(0, 0, 0, 0.54)" : "rgba(255, 255, 255, 1)") : "rgba(0, 0, 0, 0.54)" }} | ||
{...this.props} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default Icon; |
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