Skip to content

Commit

Permalink
💥 Global Styles
Browse files Browse the repository at this point in the history
Global Styles
  • Loading branch information
SaishJ committed Oct 3, 2022
1 parent 4c4fa61 commit 9eca330
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
5. [Pass Props and Adding Attributes](https://github.com/SaishJ/React-Styled-Components/commit/8f539b92b7f699a2b25d967373270eae1da6e7ea)

6. [Animations](https://github.com/SaishJ/React-Styled-Components/commit/c8331ef90df567127673490e00ffd3c48858667a)

7. [Theming](https://github.com/SaishJ/React-Styled-Components/commit/4c4fa61c670ec1a7762e16525fbb3980f00516eb)
18 changes: 17 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./App.css";
import logo from "./logo.svg";
// import styled from "styled-components";
import { ThemeProvider } from "styled-components";
import { ThemeProvider, createGlobalStyle } from "styled-components";
import StyledButton, {
FancyButton,
SubmitButton,
Expand Down Expand Up @@ -32,11 +32,27 @@ const theme = {
primary: "#fff",
text: "#000",
},
fontFamily: "Segoe UI",
};

// Gloabl Styles with props
const GlobalStyles = createGlobalStyle`
button {
font-family: ${(props) => props.theme.fontFamily}
}
`;

// Gloabl Styles without props
// const GloablStyles = createGlobalStyle`
// button {
// font-family: 'Roboto';
// }
// `;

function App() {
return (
<ThemeProvider theme={theme}>
<GlobalStyles />
<div className="App">
<AnimatedLogo src={logo} />
<div>
Expand Down

0 comments on commit 9eca330

Please sign in to comment.