diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index bb8d793a0f..7698896e7b 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -5,6 +5,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline # [3.0.0](https://github.com/mondaycom/vibe/compare/@vibe/core@3.0.0-rc.0...@vibe/core@3.0.0) (2024-11-24) +We're excited to announce the release of Vibe v3! 🎉 + +See the complete changelog of v3 [here](https://github.com/mondaycom/vibe/blob/master/packages/core/docs/vibe-3-changelog.md). To migrate, follow the [migration guide](https://vibe.monday.com/?path=/docs/migration-guide--docs). ### Bug Fixes diff --git a/packages/storybook-blocks/src/components/anchor/anchor-icon.tsx b/packages/storybook-blocks/src/components/anchor/anchor-icon.tsx new file mode 100644 index 0000000000..1b8b47776d --- /dev/null +++ b/packages/storybook-blocks/src/components/anchor/anchor-icon.tsx @@ -0,0 +1,14 @@ +import React from 'react'; + +export default function AnchorIcon() { + return ( + + + + ); +} diff --git a/packages/storybook-blocks/src/components/anchor/anchor.module.scss b/packages/storybook-blocks/src/components/anchor/anchor.module.scss new file mode 100644 index 0000000000..2fb2c4a84b --- /dev/null +++ b/packages/storybook-blocks/src/components/anchor/anchor.module.scss @@ -0,0 +1,3 @@ +.anchor { + transition: opacity 0.1s ease-in-out; +} diff --git a/packages/storybook-blocks/src/components/anchor/anchor.tsx b/packages/storybook-blocks/src/components/anchor/anchor.tsx new file mode 100644 index 0000000000..7c684ca0d9 --- /dev/null +++ b/packages/storybook-blocks/src/components/anchor/anchor.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import styles from './anchor.module.scss'; +import AnchorIcon from './anchor-icon'; +import cx from 'classnames'; + +interface AnchorProps { + id: string; + className?: string; +} + +export default function Anchor({ id, className }: AnchorProps) { + const handleClick = () => { + if (window.parent) { + // Update the parent window hash to match the clicked anchor + window.parent.location.hash = `#${id}`; + } + }; + + return ( + + + + ); +} diff --git a/packages/storybook-blocks/src/components/section-name/section-name.module.scss b/packages/storybook-blocks/src/components/section-name/section-name.module.scss index 772b3df253..caa92cc285 100644 --- a/packages/storybook-blocks/src/components/section-name/section-name.module.scss +++ b/packages/storybook-blocks/src/components/section-name/section-name.module.scss @@ -1,4 +1,4 @@ -@import "../../styles/mixins/typography"; +@import '../../styles/mixins/typography'; .sectionName { margin-top: var(--sb-spacing-between-sections); @@ -10,10 +10,19 @@ line-height: 33px; letter-spacing: -1px; text-align: left; - display: grid; + + .anchor { + margin-left: var(--sb-spacing-small); + opacity: 0; + } + + &:hover .anchor { + opacity: 1; + } &:after { - content: ""; + content: ''; + display: block; margin-top: var(--sb-spacing-small); background: var(--sb-primary-text-color); height: 2px; diff --git a/packages/storybook-blocks/src/components/section-name/section-name.tsx b/packages/storybook-blocks/src/components/section-name/section-name.tsx index 44972d96d9..c1c25d94e7 100644 --- a/packages/storybook-blocks/src/components/section-name/section-name.tsx +++ b/packages/storybook-blocks/src/components/section-name/section-name.tsx @@ -1,6 +1,7 @@ import React, { useMemo } from 'react'; import cx from 'classnames'; import styles from './section-name.module.scss'; +import Anchor from '../anchor/anchor'; interface SectionNameProps extends React.HTMLAttributes { className?: string; @@ -16,6 +17,7 @@ const SectionName: React.FC = ({ className, children, ...props return (

{children} +

); }; diff --git a/packages/storybook-blocks/src/components/title/title.module.scss b/packages/storybook-blocks/src/components/title/title.module.scss index e02b0562a5..65858c7aca 100644 --- a/packages/storybook-blocks/src/components/title/title.module.scss +++ b/packages/storybook-blocks/src/components/title/title.module.scss @@ -1,5 +1,14 @@ -@import "../../styles/mixins/typography"; +@import '../../styles/mixins/typography'; .title { @include sb-title-appearance; + + .anchor { + margin-left: var(--sb-spacing-small); + opacity: 0; + } + + &:hover .anchor { + opacity: 1; + } } diff --git a/packages/storybook-blocks/src/components/title/title.tsx b/packages/storybook-blocks/src/components/title/title.tsx index 589d73ecba..c562e2ae85 100644 --- a/packages/storybook-blocks/src/components/title/title.tsx +++ b/packages/storybook-blocks/src/components/title/title.tsx @@ -1,13 +1,25 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import cx from 'classnames'; import styles from './title.module.scss'; +import Anchor from '../anchor/anchor'; interface TitleProps extends React.HTMLProps { + children: string; className?: string; } -const Title: React.FC = ({ className, ...props }) => { - return

; +const Title: React.FC = ({ className, children, ...props }) => { + const id = useMemo( + () => children.toLowerCase().replaceAll('’', '').replaceAll("'", '').split(' ').join('-'), + [children], + ); + + return ( +

+ {children} + +

+ ); }; export default Title;