Skip to content

Commit

Permalink
WJ-75 - New: EnvironmentLabel;
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Teixeira committed Oct 17, 2020
1 parent 996e99c commit caad1d6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';

import { EnvironmentLabel } from 'components';
import AppProvider from 'hooks';
import Routes from './routes';
import GlobalStyle from './shared/styles/global';
Expand All @@ -10,6 +11,7 @@ const App: React.FC = () => {
<>
<Router>
<AppProvider>
<EnvironmentLabel />
<Routes />
</AppProvider>

Expand Down
13 changes: 13 additions & 0 deletions src/components/EnvironmentLabel/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import { Container } from './styles';

const EnvironmentLabel: React.FC = () => {
if (process.env.REACT_APP_IS_PRODUCTION === 'true') {
return null;
}

return <Container>Ambiente: Desenvolvimento</Container>;
};

export default EnvironmentLabel;
19 changes: 19 additions & 0 deletions src/components/EnvironmentLabel/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styled from 'styled-components';

import { Color, Size } from 'shared/enums';

export const Container = styled.div`
display: flex;
width: 100%;
align-items: center;
justify-content: center;
background: ${Color.Secondary};
color: ${Color.FillSecondary};
padding: ${Size.Smallest};
font-size: ${Size.Small};
position: fixed;
top: 0;
z-index: 50;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
`;
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as Button } from './Button';
export { default as EnvironmentLabel } from './EnvironmentLabel';
export { default as Input } from './Input';
export { default as Movie } from './Movie';
export { default as MovieHighlight } from './MovieHighlight';
Expand Down
9 changes: 8 additions & 1 deletion src/shared/styles/global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createGlobalStyle } from 'styled-components';
import { createGlobalStyle, css } from 'styled-components';
import { Color, Size } from 'shared/enums';

export default createGlobalStyle`
Expand Down Expand Up @@ -26,6 +26,13 @@ export default createGlobalStyle`
color: ${Color.Text};
font-size: ${Size.Default};
-webkit-font-smoothing: antialiased;
${
process.env.REACT_APP_IS_PRODUCTION === 'false' &&
css`
margin-top: ${Size.Large};
`
}
}
body, input, button {
font-weight: 100;
Expand Down

0 comments on commit caad1d6

Please sign in to comment.