mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Add styleguidist docs.
This commit is contained in:
		@@ -11,6 +11,6 @@ const [value, setValue] = useState(false);
 | 
			
		||||
    value={value}
 | 
			
		||||
    label="Some label" 
 | 
			
		||||
    helpText="Read the small text!"
 | 
			
		||||
    onChange={value => setValue(value)}
 | 
			
		||||
    onChange={e => setValue(e.target.value)}
 | 
			
		||||
/>
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ import React from "react";
 | 
			
		||||
import PropTypes from "prop-types";
 | 
			
		||||
import Datetime from "react-datetime/DateTime";
 | 
			
		||||
import moment from "moment/moment";
 | 
			
		||||
import "react-datetime/css/react-datetime.css";
 | 
			
		||||
 | 
			
		||||
import { Input } from "./Input";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ const [email, setEmail] = useState('Wrong email');
 | 
			
		||||
        value={email}
 | 
			
		||||
        label="Some label" 
 | 
			
		||||
        helpText="Read the small text!"
 | 
			
		||||
        onChange={target => setEmail(target.value)}
 | 
			
		||||
        onChange={e => setEmail(e.target.value)}
 | 
			
		||||
    />
 | 
			
		||||
    <button type="submit">Try to submit</button>
 | 
			
		||||
</form>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,13 @@
 | 
			
		||||
Bootstrap modal component.
 | 
			
		||||
 | 
			
		||||
I have no idea why example doesn't work here but you can investigate HTML code...
 | 
			
		||||
it's required to have an element `<div id={"modal-container"}/>` somewhere on the page since modals are rendered in portals.
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
    <div id={"modal-container"}/>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
I have no idea why example doesn't work here but you can investigate HTML code and Foris project.
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
import {ModalHeader, ModalBody, ModalFooter} from './Modal';
 | 
			
		||||
 | 
			
		||||
@@ -8,7 +15,7 @@ import {useState} from 'react';
 | 
			
		||||
const [shown, setShown] = useState(false);
 | 
			
		||||
 | 
			
		||||
<>
 | 
			
		||||
    <Modal shown={shown}>
 | 
			
		||||
    <Modal setShown={setShown} shown={shown}>
 | 
			
		||||
        <ModalHeader setShown={setShown} title='Warning!'/>
 | 
			
		||||
        <ModalBody><p>Bla bla bla...</p></ModalBody>
 | 
			
		||||
        <ModalFooter>
 | 
			
		||||
@@ -19,9 +26,8 @@ const [shown, setShown] = useState(false);
 | 
			
		||||
        </ModalFooter>
 | 
			
		||||
    </Modal>
 | 
			
		||||
    
 | 
			
		||||
    <button 
 | 
			
		||||
        className='btn btn-secondary'
 | 
			
		||||
        onClick={()=>setShown(true)}
 | 
			
		||||
    >Show modal</button>
 | 
			
		||||
    <button className='btn btn-secondary' onClick={()=>setShown(true)}>
 | 
			
		||||
        Show modal
 | 
			
		||||
    </button>
 | 
			
		||||
</>
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,6 @@ const [value, setValue] = useState(42);
 | 
			
		||||
    helpText="Read the small text!"
 | 
			
		||||
    min='33'
 | 
			
		||||
    max='54'
 | 
			
		||||
    onChange={target => setValue(target.value)}
 | 
			
		||||
    onChange={e => setValue(e.target.value)}
 | 
			
		||||
/>
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,6 @@ const [value, setValue] = useState('secret');
 | 
			
		||||
    value={value}
 | 
			
		||||
    label="Some password" 
 | 
			
		||||
    helpText="Read the small text!"
 | 
			
		||||
    onChange={target => setValue(target.value)}
 | 
			
		||||
    onChange={e => setValue(e.target.value)}
 | 
			
		||||
/>
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ const [value, setValue] = useState(CHOICES[0].value);
 | 
			
		||||
        value={value}
 | 
			
		||||
        name='some-radio'
 | 
			
		||||
        choices={CHOICES}
 | 
			
		||||
        onChange={event=>setValue(event.target.value)}
 | 
			
		||||
        onChange={e => setValue(e.target.value)}
 | 
			
		||||
    />
 | 
			
		||||
    <p>Selected value: {value}</p>
 | 
			
		||||
</>
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,6 @@ const [value, setValue] = useState('Bla bla');
 | 
			
		||||
    value={value}
 | 
			
		||||
    label="Some text" 
 | 
			
		||||
    helpText="Read the small text!"
 | 
			
		||||
    onChange={event => setValue(event.target.value)}
 | 
			
		||||
    onChange={e => setValue(e.target.value)}
 | 
			
		||||
/>
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user