Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the default app weight by removing the image background on the Login screen #4342

Merged
merged 4 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/Theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,12 +842,17 @@ export default withRouter(Menu);

### Changing the Background Image

By default, the login page displays a random background image changing every day. If you want to change that background image, you can use the default Login page component and pass an image URL as the `backgroundImage` prop.
By default, the login page displays a gradient background. If you want to change the background, you can use the default Login page component and pass an image URL as the `backgroundImage` prop.

```jsx
import { Admin, Login } from 'react-admin';

const MyLoginPage = () => <Login backgroundImage="/background.jpg" />;
const MyLoginPage = () => (
<Login
// A random image that changes everyday
backgroundImage="https://source.unsplash.com/random/1600x900/daily"
/>
);

const App = () => (
<Admin loginPage={MyLoginPage}>
Expand Down
3 changes: 2 additions & 1 deletion packages/ra-ui-materialui/src/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const useStyles = makeStyles(
justifyContent: 'flex-start',
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundImage:
Copy link
Member

@fzaninotto fzaninotto Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested alternative: 'radial-gradient(circle at 50% 14em, #313264 0%, #00023b 60%, #00023b 100%)'

'radial-gradient(circle at 50% 14em, #313264 0%, #00023b 60%, #00023b 100%)',
},
card: {
minWidth: 300,
Expand Down Expand Up @@ -160,7 +162,6 @@ Login.propTypes = {
};

Login.defaultProps = {
backgroundImage: 'https://source.unsplash.com/random/1600x900/daily',
theme: defaultTheme,
children: <DefaultLoginForm />,
};
Expand Down