Debian Codegraph @

examples/react-spa/frontend/src/Home.js

raw
1 function Service (props) {
2 return (
3 <div className='col'>
4 <img className='img-fluid' src={props.img} />
5 <h3>{props.title}</h3>
6 <a href={props.link}>{props.linkBody}</a>
7 </div>
8 )
9 }
10
11 function Channel (props) {
12 return (
13 <div className='col'>
14 <hr className={`aa-channel ${props.rev ? 'aa-channel-rev' : ''}`} />
15 <div className='d-none d-lg-block' style={{ fontVariant: 'small-caps' }}>◀ {props.emoji} <span className=''>{props.title}</span> ▶</div>
16 </div>
17 )
18 }
19
20 export default function Home () {
21 return (
22 <div>
23 <div className='container p-4 my-4 rounded-4 bg-light text-center'>
24 <div className='d-flex flex-1 flex-column flex-sm-row align-items-sm-center'>
25
26 <Service img='/img/app.svg' title='Mobile / SPA' link='https://app.react.demo.allauth.org' linkBody={<>app.<i>{'{project.org}'}</i></>} />
27 <Channel emoji='🔑' title='tokens' />
28 <Service img='/img/allauth.svg' title='Headless' link='https://api.react.demo.allauth.org/_allauth/openapi.html' linkBody={<>api.<i>{'{project.org}'}</i></>} />
29 <Channel rev emoji='🍪' title='cookies' />
30 <Service img='/img/react.svg' title='Single-Page application' link='https://react.demo.allauth.org' linkBody={<i>{'{project.org}'}</i>} />
31
32 </div>
33 </div>
34
35 <h1>Welcome!</h1>
36
37 <p>Welcome to the headless django-allauth demo. It demonstrates:</p>
38 <ul>
39 <li>A <strong>React</strong> <a target='_blank' href='https://codeberg.org/allauth/django-allauth/src/branch/main/examples/react-spa/frontend' rel='noreferrer'>frontend app</a> interfacing with <code>allauth.headless</code>.</li>
40 <li>The use of <strong>session cookies</strong>, as well as <strong>API tokens</strong>.</li>
41 <li>A <a href='/calculator'>calculator</a>, allowing <i>authenticated</i> users to add up two numbers, built using an API backed by two implementations: Django REST framework, and Ninja.
42 </li>
43 <li>The use of headless <strong>tokens</strong> in frameworks such as Django REST framework and Ninja.</li>
44 </ul>
45 </div>
46 )
47 }