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; |
return ( |
||||||
|
<> |
||||||
|
<nav className="nav-btn"> |
||||||
|
<button |
||||||
|
onClick={() => setBookStyle({ ...bookStyle, fontFamily: "Sans" })} |
||||||
|
className="btn-font" |
||||||
|
> |
||||||
|
سانس |
||||||
|
</button> |
||||||
|
<button |
||||||
|
onClick={() => setBookStyle({ ...bookStyle, fontFamily: "Nazanin" })} |
||||||
|
className="btn-font" |
||||||
|
> |
||||||
|
نازنین |
||||||
|
</button> |
||||||
|
</nav> |
||||||
|
</> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
const fontHandler = (value) =>{ |
export default Fonts; |
||||||
setname(value) |
|
||||||
} |
|
||||||
|
|
||||||
|
// ()=>setBookStyle({fontFamily: bookStyle.fontFamily === "Nazanin" })
|
||||||
return ( |
// ()=>setBookStyle({fontFamily: bookStyle.fontFamily === "Sans" })
|
||||||
<> |
|
||||||
<nav className='nav-btn'> |
|
||||||
<button onClick={() => fontHandler('Sans')} className='btn-font'>سانس</button> |
|
||||||
<button onClick={() => fontHandler('Nazanin')} className='btn-font'>نازنین</button> |
|
||||||
</nav> |
|
||||||
</> |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
export default Fonts |
|
||||||
|
@ -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 toggle = () => setDropdownOpen((prevState) => !prevState); |
||||||
|
|
||||||
const [dropdownOpen, setDropdownOpen] = useState(false); |
return ( |
||||||
const toggle = () => setDropdownOpen(prevState => !prevState) |
<div> |
||||||
|
<Dropdown isOpen={dropdownOpen} toggle={toggle}> |
||||||
|
<DropdownToggle id="dropdown-btn"> |
||||||
|
<button className="btn-font"> |
||||||
|
<p>{bookStyle.fontFamily === "Sans" ? "سانس" : "نازنین"}</p> |
||||||
|
</button> |
||||||
|
</DropdownToggle> |
||||||
|
<DropdownMenu className="nav-menu-font"> |
||||||
|
<Fonts bookStyle={bookStyle} setBookStyle={setBookStyle} /> |
||||||
|
</DropdownMenu> |
||||||
|
</Dropdown> |
||||||
|
</div> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
return ( |
export default Fontstyle; |
||||||
<div> |
|
||||||
<Dropdown isOpen={dropdownOpen} toggle={toggle}> |
|
||||||
<DropdownToggle id='dropdown-btn'> |
|
||||||
<button className='btn-font'> |
|
||||||
<p> |
|
||||||
{name === 'Sans' ? 'سانس': 'نازنین'} |
|
||||||
</p> |
|
||||||
</button> |
|
||||||
</DropdownToggle> |
|
||||||
<DropdownMenu className='nav-menu-font'> |
|
||||||
<Fonts
|
|
||||||
setname={setname} |
|
||||||
/> |
|
||||||
</DropdownMenu> |
|
||||||
</Dropdown> |
|
||||||
</div> |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
export default Fontstyle |
|
||||||
|
Loading…
Reference in new issue