Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/{{ package }}';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style=\{{height: '8rem', display: 'block'}}>
<Button
size="s"
style=\{{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
4 changes: 4 additions & 0 deletions packages/plasma-new-hope/src/components/Note/Note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export const noteRoot = (Root: RootProps<HTMLDivElement, NoteProps>) =>
setTruncatedText();
}, [text, contentBefore, contentBeforeSizing, stretch]);

useEffect(() => {
setTruncatedText();
}, [text]);

useEffect(() => {
if (!contentBeforeRef?.current) {
return;
Expand Down
39 changes: 39 additions & 0 deletions website/plasma-b2c-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,42 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/plasma-b2c';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```

38 changes: 38 additions & 0 deletions website/plasma-giga-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/plasma-giga';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/plasma-web-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/plasma-web';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/sdds-crm-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/sdds-crm';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/sdds-dfa-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/sdds-dfa';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/sdds-finportal-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/sdds-finportal';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/sdds-insol-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/sdds-insol';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
38 changes: 38 additions & 0 deletions website/sdds-netology-docs/docs/components/Note.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ export function App() {
);
}
```

### hasClose и contolled вариант
Свойство `hasClose` добавляет крестик в правом верхнем углу. При нажатии сработает функция `onCloseButtonClick`

```tsx live
import React from 'react';
import { Note, Button } from '@salutejs/sdds-netology';
import { IconSaluteOutline } from '@salutejs/plasma-icons';

export function App() {
const [state, setState] = useState(true);

return (
<div style={{height: '8rem', display: 'block'}}>
<Button
size="s"
style={{ marginBottom: "0.5rem" }}
onClick={() => setState(!state)}
>
Открыть
</Button>
{state && (
<Note
title="Ваш заголовок"
text="Пример с возможностью закрыть по control"
view="default"
size="s"
hasClose
onCloseButtonClick={() => {
setState(false);
}}
/>
)}
</div>
);
}

```
Loading
Loading