Skip to content

Commit 8778acb

Browse files
fix: fix ui bug in naa (#14199)
1 parent ba48d70 commit 8778acb

File tree

2 files changed

+60
-54
lines changed
  • templates/vsc
    • js/sso-tab-naa/src/components
    • ts/sso-tab-naa/src/components

2 files changed

+60
-54
lines changed

templates/vsc/js/sso-tab-naa/src/components/App.jsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,42 @@ import Privacy from "./Privacy";
1212
import TermsOfUse from "./TermsOfUse";
1313
import Tab from "./Tab";
1414
import { useTeams } from "./sample/lib/useTeams";
15+
import { TeamsFxContext } from "./Context";
1516

1617
/**
1718
* The main app which handles the initialization and routing
1819
* of the app.
1920
*/
2021
export default function App() {
21-
const { loading, themeString } = useTeams();
22+
const [{ loading, themeString, theme }] = useTeams();
2223
return (
23-
<FluentProvider
24-
theme={
25-
themeString === "dark"
26-
? teamsDarkTheme
27-
: themeString === "contrast"
28-
? teamsHighContrastTheme
29-
: {
30-
...teamsLightTheme,
31-
colorNeutralBackground3: "#eeeeee",
32-
}
33-
}
34-
style={{ background: tokens.colorNeutralBackground3 }}
35-
>
36-
<Router>
37-
{loading ? (
38-
<Spinner style={{ margin: 100 }} />
39-
) : (
40-
<Routes>
41-
<Route path="/privacy" element={<Privacy />} />
42-
<Route path="/termsofuse" element={<TermsOfUse />} />
43-
<Route path="/tab" element={<Tab />} />
44-
<Route path="*" element={<Navigate to={"/tab"} />}></Route>
45-
</Routes>
46-
)}
47-
</Router>
48-
</FluentProvider>
24+
<TeamsFxContext.Provider value={{ theme, themeString }}>
25+
<FluentProvider
26+
theme={
27+
themeString === "dark"
28+
? teamsDarkTheme
29+
: themeString === "contrast"
30+
? teamsHighContrastTheme
31+
: {
32+
...teamsLightTheme,
33+
colorNeutralBackground3: "#eeeeee",
34+
}
35+
}
36+
style={{ background: tokens.colorNeutralBackground3 }}
37+
>
38+
<Router>
39+
{loading ? (
40+
<Spinner style={{ margin: 100 }} />
41+
) : (
42+
<Routes>
43+
<Route path="/privacy" element={<Privacy />} />
44+
<Route path="/termsofuse" element={<TermsOfUse />} />
45+
<Route path="/tab" element={<Tab />} />
46+
<Route path="*" element={<Navigate to={"/tab"} />}></Route>
47+
</Routes>
48+
)}
49+
</Router>
50+
</FluentProvider>
51+
</TeamsFxContext.Provider>
4952
);
5053
}

templates/vsc/ts/sso-tab-naa/src/components/App.tsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,42 @@ import Privacy from "./Privacy";
1212
import TermsOfUse from "./TermsOfUse";
1313
import Tab from "./Tab";
1414
import { useTeams } from "./sample/lib/useTeams";
15+
import { TeamsFxContext } from "./Context";
1516

1617
/**
1718
* The main app which handles the initialization and routing
1819
* of the app.
1920
*/
2021
export default function App() {
21-
const { loading, themeString } = useTeams();
22+
const [{ loading, themeString, theme }] = useTeams();
2223
return (
23-
<FluentProvider
24-
theme={
25-
themeString === "dark"
26-
? teamsDarkTheme
27-
: themeString === "contrast"
28-
? teamsHighContrastTheme
29-
: {
30-
...teamsLightTheme,
31-
colorNeutralBackground3: "#eeeeee",
32-
}
33-
}
34-
style={{ background: tokens.colorNeutralBackground3 }}
35-
>
36-
<Router>
37-
{loading ? (
38-
<Spinner style={{ margin: 100 }} />
39-
) : (
40-
<Routes>
41-
<Route path="/privacy" element={<Privacy />} />
42-
<Route path="/termsofuse" element={<TermsOfUse />} />
43-
<Route path="/tab" element={<Tab />} />
44-
<Route path="*" element={<Navigate to={"/tab"} />}></Route>
45-
</Routes>
46-
)}
47-
</Router>
48-
</FluentProvider>
24+
<TeamsFxContext.Provider value={{ theme, themeString }}>
25+
<FluentProvider
26+
theme={
27+
themeString === "dark"
28+
? teamsDarkTheme
29+
: themeString === "contrast"
30+
? teamsHighContrastTheme
31+
: {
32+
...teamsLightTheme,
33+
colorNeutralBackground3: "#eeeeee",
34+
}
35+
}
36+
style={{ background: tokens.colorNeutralBackground3 }}
37+
>
38+
<Router>
39+
{loading ? (
40+
<Spinner style={{ margin: 100 }} />
41+
) : (
42+
<Routes>
43+
<Route path="/privacy" element={<Privacy />} />
44+
<Route path="/termsofuse" element={<TermsOfUse />} />
45+
<Route path="/tab" element={<Tab />} />
46+
<Route path="*" element={<Navigate to={"/tab"} />}></Route>
47+
</Routes>
48+
)}
49+
</Router>
50+
</FluentProvider>
51+
</TeamsFxContext.Provider>
4952
);
5053
}

0 commit comments

Comments
 (0)