Skip to content

Commit

Permalink
Merge pull request #103 from NIAEFEUP/feature/font
Browse files Browse the repository at this point in the history
Change font
  • Loading branch information
ttoino authored Aug 22, 2023
2 parents 0f232cf + bacf309 commit 0491b59
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
7 changes: 5 additions & 2 deletions content-scripts/src/modules/options/all.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import {
hideShortcuts,
changeFont
} from "./some_options";

// Array of user preferences, passed to `injectAllChanges`
export const userPreferences = [
"shortcuts",
"autoLogin"
"autoLogin",
"font"
];

export const injectAllChanges = (data) => {
hideShortcuts(data?.shortcuts);
hideShortcuts(data?.shortcuts);
changeFont(data?.font);
};
24 changes: 22 additions & 2 deletions content-scripts/src/modules/options/some_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,27 @@ export const hideShortcuts = (shortcuts) => {
break;

case "off":
removeElement("se-hide-shortcuts");
removeElement("#se-hide-shortcuts");
break;
}
};
};

export const changeFont = (font) => {
console.log(font);
switch (font) {
case "on":
addStyles(
"se-change-font",
`
* {
font-family: Roboto, sans-serif;
}
`
);
break;

case "off":
removeElement("#se-change-font");
break;
}
}
2 changes: 2 additions & 0 deletions css/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

/* Página: Inscrições nas Turmas */

ul[id^="list_"]{
Expand Down
3 changes: 3 additions & 0 deletions popup/components/sections/LayoutContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const LayoutContent = () => (
<SwitchControl
label="Relembrar utilizador"
storageKey="autoLogin"/>
<SwitchControl
label="Mudar fonte de letra"
storageKey="font"/>
</div>
</div>
</form>
Expand Down

0 comments on commit 0491b59

Please sign in to comment.