forked from sleepy-zone/fabritor-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7288f5a
commit c2f1168
Showing
7 changed files
with
97 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useContext, useEffect } from 'react'; | ||
import { Space, Button } from 'antd'; | ||
import { BoldOutlined, ItalicOutlined, UnderlineOutlined, StrikethroughOutlined } from '@ant-design/icons'; | ||
|
||
const FONT_STYLES = [ | ||
{ | ||
icon: <BoldOutlined />, | ||
value: 'bold' | ||
}, | ||
{ | ||
icon: <ItalicOutlined />, | ||
value: 'italic' | ||
}, | ||
{ | ||
icon: <UnderlineOutlined />, | ||
value: 'underline' | ||
}, | ||
{ | ||
icon: <StrikethroughOutlined />, | ||
value: 'linethrough' | ||
} | ||
] | ||
|
||
export default function FontStylePanel (props) { | ||
const { value, onChange } = props; | ||
|
||
const handleClick = (v) => { | ||
onChange && onChange({ | ||
...value, | ||
[v]: !value[v] | ||
}); | ||
} | ||
|
||
useEffect(() => { | ||
console.log(value) | ||
}, [value]); | ||
|
||
return ( | ||
<Space.Compact block> | ||
{ | ||
FONT_STYLES.map(FONT_STYLE => ( | ||
<Button | ||
style={{ width: 50 }} | ||
icon={FONT_STYLE.icon} | ||
key={FONT_STYLE.value} | ||
type={ value?.[FONT_STYLE.value] ? 'primary' : 'default' } | ||
ghost={value?.[FONT_STYLE.value]} | ||
onClick={() => { handleClick(FONT_STYLE.value) }} | ||
/> | ||
)) | ||
} | ||
</Space.Compact> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters