I have created a custom sign up page that i am trying to access from a custom login screen. I am using the firebase connecters for authProvider. How can I allow the page to go to the sign up page without being authenticated?
Here is the app.tsx:
function App() {
return (
<Admin
authProvider={firebaseAuthProvider}
dataProvider={firebaseDataProvider}
i18nProvider={i18nProvider}
loginPage={LoginPage}
>
<Resource name="researchers" list={ListGuesser} />
<CustomRoutes noLayout>
<Route path="/signup" element={<SignUpPage />} />
</CustomRoutes>
</Admin>
);
}
And the login page:
import React from "react";
import {
Stack,
Card,
CardContent,
Typography,
TextField,
Button,
Link,
} from "#mui/material";
import { Title, useTranslate } from "react-admin";
export const LoginPage = () => {
const t = useTranslate();
const handleSubmit = () => {};
return (
<Card>
<Title title="Sign Up!" />
<CardContent>
<Stack>
<Stack alignItems="center">
<Typography>{t("login.login")}</Typography>
</Stack>
<Stack component="form" onSubmit={handleSubmit}>
<TextField
margin="normal"
required
fullWidth
id="email"
label={t("email")}
name="email"
autoComplete="email"
autoFocus
/>
<TextField
margin="normal"
required
fullWidth
name="password"
label={t("password")}
type="password"
id="password"
autoComplete="current-password"
/>
<Button
type="submit"
fullWidth
variant="contained"
sx={{ mt: 3, mb: 2 }}
>
{t("login.signin")}
</Button>
</Stack>
<Typography>{t("login.or")}</Typography>
<Link href="/signup">{t("signup.signup")}</Link>
</Stack>
</CardContent>
</Card>
);
};
The link on the login page is where the problem is.
I faced the same problem and kind of sorted it out. I think it's a problem with RAF. By default you don't need to write extra codes to make it work.
I have posted here.
Related
I am using Grommet to build a dashboard with <Grid>.
If using three columns, responsive behaviour is as expected when the window is made smaller:
But if using four columns there is no breakpoint at which the cards stack on top of each other:
The code is out-of-the box and so the expectation is for the built-in responsive behaviour to kick-in:
<Grommet full theme={grommet}>
<Page>
<PageContent border={{"side":"bottom"}}>
<Header align="center" direction="row" flex={false} justify="between" gap="medium">
<Anchor label="Title" icon={<Home />} />
<Menu icon={<User />} items={[{"label":"sign out"}]} />
</Header>
</PageContent>
<PageContent>
<PageHeader title="Dashboard" margin={{"vertical":"medium"}} />
<Grid columns="1/4" gap="medium">
<Meditation />
<Habits />
<Chart />
<Card><Text>Everything is ok!</Text></Card>
</Grid>
</PageContent>
</Page>
</Grommet>
(Each imported item is just a <Card pad="small">)
I have a divider template and I want to customize it by transforming it into a horizontal dashed divider. But I'm not sure how to override it, especially if I even do an sx edit by applying a borderRadius, it doesn't change the divider.
source code:
import * as React from "react";
import List from "#mui/material/List";
import ListItem from "#mui/material/ListItem";
import ListItemText from "#mui/material/ListItemText";
import Divider from "#mui/material/Divider";
const style = {
width: "100%",
maxWidth: 360,
bgcolor: "background.paper"
};
export default function ListDividers() {
return (
<List sx={style} component="nav" aria-label="mailbox folders">
<ListItem button>
<ListItemText primary="Inbox" />
</ListItem>
<Divider sx={{ borderRadius: 1 }} />
<ListItem button divider>
<ListItemText primary="Drafts" />
</ListItem>
<ListItem button>
<ListItemText primary="Trash" />
</ListItem>
<Divider sx={{ borderRadius: 1 }} />
<ListItem button>
<ListItemText primary="Spam" />
</ListItem>
</List>
);
}
Current appearance:
Goal appearance of divider:
Your responses would indeed help me a lot, especially since I am exploring MUI as of this moment. I am also open to alternatives in terms of Dividers. Thank you very much!
you can use borderStyle:'dashed' as a property in sx :
sx={{borderStyle:'dashed'}}
Not sure if this is some CSS issue that I can fix, but I am trying to use a <Stack /> from Material UI to construct a vertical list of checkboxs with labels.
I've attempted the following in the sandbox here (see demo.tsx): https://codesandbox.io/embed/basicstack-material-demo-forked-q8kb4q?fontsize=14&hidenavigation=1&theme=dark
With the code here
export default function BasicStack() {
return (
<Box sx={{ width: "100%" }}>
<Stack spacing={2}>
<FormControlLabel control={<Checkbox />} label="Test1" />
<FormControlLabel control={<Checkbox />} label="Test2" />
<FormControlLabel control={<Checkbox />} label="Test3" />
</Stack>
</Box>
);
}
As you can see in the demo, ONLY the first child component isn't lined up correctly so a temporary solution is to add a sx={{marginLeft: 0.1}} only to the first <FormControlLabel /> which I think isn't a great practice. Does anyone know why this misalignment happens? And if there is a more elegant way of fixing it?
I think the problem is on the spacing=2, you can try to remove it, and then the indented will correct.
<Stack>
<FormControlLabel control={<Checkbox />} label="Test1" />
<FormControlLabel control={<Checkbox />} label="Test2" />
<FormControlLabel control={<Checkbox />} label="Test3" />
</Stack>
I am working with Antd Form Item and I have to put an icon with tooltip like this:
And here is my code:
<Item label={'Password'} name={'password'} className={'password'} rules={[{ required: true, message: t('Feld ist erforderlich') }]}>
<Password size="large" />
<PasswordStrength password={password} />
</Item>
Any idea? Please help! Thank you!
Solution 1: You can custom label in Form item, follow my code
<Item
label={
<div>
Label a{" "}
<Tooltip title="Tooltip with customize">
<InfoCircleOutlined />
</Tooltip>
</div>
}
>
<Input placeholder="input placeholder" />
</Item>
Solution 2: you can upgrade new version Antd, and use property tooltip
I hope it useful for you.
I got same problem and work around by below solution:
I don't set label attribute for Form.Item, then add a Row on top of Form Item including label and tooltip icon
<Row justify="space-between">
<Col>
<span>Mật Khẩu</span>
</Col>
<Col>
<Tooltip title='tooltip text'>
<ExclamationCircleOutlined />
</Tooltip>
</Col>
</Row>
<Form.Item>
<Input.Password />
</Form.Item>
I am working on an Application that will be using an Authentication method to login specific users. I am looking to have a page directly after login, where it will say "Welcome back, (Insert users name here). I understand that Firebase does not incorporate any sort of Name with a login.
How would you recommend I accomplish this?
LoginForm.js
<Card style={{ marginBottom: 200 }}>
<CardSection style={styles.inputStyle}>
<Input
label="Email"
placeholder="Username"
onChangeText={this.onEmailChange.bind(this)}
value={this.props.email}
/>
</CardSection>
<CardSection style={styles.inputStyle}>
<Input
secureTextEntry
label="Password"
placeholder="Password"
onChangeText={this.onPasswordChange.bind(this)}
value={this.props.password}
/>
</CardSection>
{this.renderError()}
<CardSection style={styles.inputStyle}>
{this.renderButton()}
</CardSection>
</Card>