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