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

fix(APP-3714): Rename default core context values to use "guk" prefix #318

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/storybook-preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
edit-mode: replace
body: |
Storybook IPFS Hash: ${{ steps.ipfs-pin.outputs.hash }}
ODS deployed to https://ipfs.eth.aragon.network/ipfs/${{ steps.ipfs-pin.outputs.hash }}/
Governance UI Kit deployed to https://ipfs.eth.aragon.network/ipfs/${{ steps.ipfs-pin.outputs.hash }}/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Fixed

- Rename default core context values to use `guk` prefix
- Update `<DefinitionListItem />` and `<Breadcrumbs />` core components to truncate long strings
- Fix `<InputNumber >` core component to trigger `onChange` callback on + / - button click

Expand Down
14 changes: 7 additions & 7 deletions src/core/components/gukCoreProvider/gukCoreProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@ export interface IGukCoreProviderProps {
children?: ReactNode;
}

const odsCoreContextDefaults: IGukCoreContext = {
const gukCoreContextDefaults: IGukCoreContext = {
Img: 'img',
Link: 'a',
copy: coreCopy,
};

const odsCoreContext = createContext<IGukCoreContext>(odsCoreContextDefaults);
const gukCoreContext = createContext<IGukCoreContext>(gukCoreContextDefaults);

export const GukCoreProvider: React.FC<IGukCoreProviderProps> = (props) => {
const { values, children } = props;

const contextValues = useMemo(
() => ({
Img: values?.Img ?? odsCoreContextDefaults.Img,
Link: values?.Link ?? odsCoreContextDefaults.Link,
copy: values?.copy ?? odsCoreContextDefaults.copy,
Img: values?.Img ?? gukCoreContextDefaults.Img,
Link: values?.Link ?? gukCoreContextDefaults.Link,
copy: values?.copy ?? gukCoreContextDefaults.copy,
}),
[values],
);

return <odsCoreContext.Provider value={contextValues}>{children}</odsCoreContext.Provider>;
return <gukCoreContext.Provider value={contextValues}>{children}</gukCoreContext.Provider>;
};

export const useGukCoreContext = (): Required<IGukCoreContext> => {
const values = useContext(odsCoreContext);
const values = useContext(gukCoreContext);

return values;
};