Comments (3)
App.js
import React, { useState } from "react"
import { Button, ButtonType } from "office-ui-fabric-react"
import Header from "./Header"
import HeroList from "./HeroList"
import Progress from "./Progress"
const handleClick = (event) => Word.run(async context => {
const paragraph = context.document.body.insertParagraph("Hello World", Word.InsertLocation.end)
paragraph.font.color = "blue"
await context.sync()
})
const App = ({ title, isOfficeInitialized }) => {
const [listItems, setListItems] = useState([
{ icon: "Ribbon", primaryText: "Achieve more with Office integration" },
{ icon: "Unlock", primaryText: "Unlock features and functionality" },
{ icon: "Design", primaryText: "Create and visualize like a pro" }
])
if (!isOfficeInitialized) {
return (
<Progress title={title} logo="assets/logo-filled.png" message="Please sideload your addin to see app body." />
);
}
return (
<div className="ms-welcome">
<Header logo="assets/logo-filled.png" title={title} message="Welcome" />
<HeroList message="Discover what Office Add-ins can do for you today!" items={listItems}>
<p className="ms-font-l">
Modify the source files, then click <b>Run</b>.
</p>
<Button
className="ms-welcome__action"
buttonType={ButtonType.hero}
iconProps={{ iconName: "ChevronRight" }}
onClick={handleClick}
>Run</Button>
</HeroList>
</div>
)
}
export default App
Header.js
import React from 'react'
const Header = ({ title, logo, message }) => (
<section className='ms-welcome__header ms-bgColor-neutralLighter ms-u-fadeIn500'>
<img width='90' height='90' src={logo} alt={title} title={title} />
<h1 className='ms-fontSize-su ms-fontWeight-light ms-fontColor-neutralPrimary'>{message}</h1>
</section>
)
export default Header
HeroList.js
import React from 'react'
const HeroList = ({ children, items, message }) => {
const listItems = items.map((item, index) => (
<li className='ms-ListItem' key={index}>
<i className={`ms-Icon ms-Icon--${item.icon}`} />
<span className='ms-font-m ms-fontColor-neutralPrimary'>{item.primaryText}</span>
</li>
))
return (
<main className='ms-welcome__main'>
<h2 className='ms-font-xl ms-fontWeight-semilight ms-fontColor-neutralPrimary ms-u-slideUpIn20'>{message}</h2>
<p>Hello World</p>
<ul className='ms-List ms-welcome__features ms-u-slideUpIn10'>{listItems}</ul>
{children}
</main>
)
}
export default HeroList
Progress.js
import React from 'react'
import { Spinner, SpinnerType } from 'office-ui-fabric-react'
const Progress = ({ logo, message, title }) => (
<section className='ms-welcome__progress ms-u-fadeIn500'>
<img width='90' height='90' src={logo} alt={title} title={title} />
<h1 className='ms-fontSize-su ms-fontWeight-light ms-fontColor-neutralPrimary'>{title}</h1>
<Spinner type={SpinnerType.large} label={message} />
</section>
)
export default Progress
from office-addin-taskpane-react-js.
Hey @sethachoi, I guess the commentary given gave some samples to help you if you are still facing the issue.
I will be closing this issue for now but feel free to reopen it if you still need help.
from office-addin-taskpane-react-js.
@sethachoi The project generated from this repo's template has just been updated to use hooks.
from office-addin-taskpane-react-js.
Related Issues (13)
- Update class components to functional components HOT 3
- Task pane has some text that shouldn't be there.
- Is there an api/programmatic way to update TaskPane cache? HOT 1
- SecurityError with websockets HOT 1
- Outlook Add In works in local dev, not in production HOT 5
- React Router HOT 1
- Looking for instructions on how to dockerize the app HOT 1
- i want to open automatically this Add-in when open word document how i can ? Extra attention is needed HOT 1
- Word insertParagraph is not working addin on Mac - only from Developer Window HOT 3
- Unable to web inspector on Mac Excel add-in HOT 5
- How to set format for Range cell HOT 2
- Missing hint in documentation? Is this example only working with a outlook-emailadresse? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from office-addin-taskpane-react-js.