Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Show hide components #78

Merged
merged 7 commits into from
Jul 5, 2021
Prev Previous commit
Next Next commit
👷 Injects visible component object, making it available to sub-compon…
…ents
  • Loading branch information
Lissy93 committed Jul 4, 2021
commit b214785c8a981094bc3386249573e34fd6d6dc59
24 changes: 18 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
import Header from '@/components/PageStrcture/Header.vue';
import Footer from '@/components/PageStrcture/Footer.vue';
import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue';
import Defaults, { localStorageKeys, splashScreenTime } from '@/utils/defaults';
import { config, appConfig, pageInfo } from '@/utils/ConfigAccumalator';
import { componentVisibility } from '@/utils/ConfigHelpers';
import ConfigAccumulator from '@/utils/ConfigAccumalator';
import {
localStorageKeys,
splashScreenTime,
visibleComponents as defaultVisibleComponents,
} from '@/utils/defaults';

const Accumulator = new ConfigAccumulator();
const config = Accumulator.config();
const visibleComponents = componentVisibility(config.appConfig) || defaultVisibleComponents;

export default {
name: 'app',
Expand All @@ -23,13 +32,15 @@ export default {
},
provide: {
config,
visibleComponents,
},
data() {
return {
showFooter: Defaults.visibleComponents.footer,
showFooter: visibleComponents.footer,
isLoading: true,
appConfig,
pageInfo,
appConfig: Accumulator.appConfig(),
pageInfo: Accumulator.pageInfo(),
visibleComponents,
};
},
methods: {
Expand All @@ -45,7 +56,8 @@ export default {
document.head.append(style);
},
shouldShowSplash() {
return this.appConfig.showSplashScreen || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER];
return (this.visibleComponents || defaultVisibleComponents).splashScreen
|| !localStorage[localStorageKeys.HIDE_WELCOME_BANNER];
},
hideSplash() {
if (this.shouldShowSplash() && !this.shouldHidePageComponents()) {
Expand Down