parent
2d399de16d
commit
dc75dd168a
12 changed files with 149 additions and 127 deletions
@ -1,23 +1,30 @@ |
|||||||
import React from 'react'; |
import React from "react"; |
||||||
import '../../../style/fonts.scss'; |
import "../../../style/fonts.scss"; |
||||||
|
|
||||||
const Fonts = (props) => { |
const Fonts = (props) => { |
||||||
|
const { setBookStyle, bookStyle } = props; |
||||||
const {setname} = props; |
|
||||||
|
|
||||||
const fontHandler = (value) =>{ |
|
||||||
setname(value) |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
return ( |
return ( |
||||||
<> |
<> |
||||||
<nav className='nav-btn'> |
<nav className="nav-btn"> |
||||||
<button onClick={() => fontHandler('Sans')} className='btn-font'>سانس</button> |
<button |
||||||
<button onClick={() => fontHandler('Nazanin')} className='btn-font'>نازنین</button> |
onClick={() => setBookStyle({ ...bookStyle, fontFamily: "Sans" })} |
||||||
|
className="btn-font" |
||||||
|
> |
||||||
|
سانس |
||||||
|
</button> |
||||||
|
<button |
||||||
|
onClick={() => setBookStyle({ ...bookStyle, fontFamily: "Nazanin" })} |
||||||
|
className="btn-font" |
||||||
|
> |
||||||
|
نازنین |
||||||
|
</button> |
||||||
</nav> |
</nav> |
||||||
</> |
</> |
||||||
) |
); |
||||||
} |
}; |
||||||
|
|
||||||
|
export default Fonts; |
||||||
|
|
||||||
export default Fonts |
// ()=>setBookStyle({fontFamily: bookStyle.fontFamily === "Nazanin" })
|
||||||
|
// ()=>setBookStyle({fontFamily: bookStyle.fontFamily === "Sans" })
|
||||||
|
@ -1,33 +1,28 @@ |
|||||||
import React , { useState } from 'react'; |
import React, { useState } from "react"; |
||||||
import { Dropdown, DropdownToggle, DropdownMenu } from 'reactstrap'; |
import { Dropdown, DropdownToggle, DropdownMenu } from "reactstrap"; |
||||||
import '../../../components/style/fontStyle.scss' |
import "../../../components/style/fontStyle.scss"; |
||||||
import Fonts from './Fonts/fonts' |
import Fonts from "./Fonts/fonts"; |
||||||
|
|
||||||
const Fontstyle = (props) => { |
const Fontstyle = (props) => { |
||||||
const {setname ,name} = props; |
const { bookStyle, setBookStyle } = props; |
||||||
|
|
||||||
|
|
||||||
const [dropdownOpen, setDropdownOpen] = useState(false); |
const [dropdownOpen, setDropdownOpen] = useState(false); |
||||||
const toggle = () => setDropdownOpen(prevState => !prevState) |
const toggle = () => setDropdownOpen((prevState) => !prevState); |
||||||
|
|
||||||
return ( |
return ( |
||||||
<div> |
<div> |
||||||
<Dropdown isOpen={dropdownOpen} toggle={toggle}> |
<Dropdown isOpen={dropdownOpen} toggle={toggle}> |
||||||
<DropdownToggle id='dropdown-btn'> |
<DropdownToggle id="dropdown-btn"> |
||||||
<button className='btn-font'> |
<button className="btn-font"> |
||||||
<p> |
<p>{bookStyle.fontFamily === "Sans" ? "سانس" : "نازنین"}</p> |
||||||
{name === 'Sans' ? 'سانس': 'نازنین'} |
|
||||||
</p> |
|
||||||
</button> |
</button> |
||||||
</DropdownToggle> |
</DropdownToggle> |
||||||
<DropdownMenu className='nav-menu-font'> |
<DropdownMenu className="nav-menu-font"> |
||||||
<Fonts
|
<Fonts bookStyle={bookStyle} setBookStyle={setBookStyle} /> |
||||||
setname={setname} |
|
||||||
/> |
|
||||||
</DropdownMenu> |
</DropdownMenu> |
||||||
</Dropdown> |
</Dropdown> |
||||||
</div> |
</div> |
||||||
) |
); |
||||||
} |
}; |
||||||
|
|
||||||
export default Fontstyle |
export default Fontstyle; |
||||||
|
Loading…
Reference in new issue